Clean up Widgets

* Move /Widgets/Live/* to /Live/*
* Move /Widgets/Prompt/* to /Prompts/*
* Move tests and expectations to match the new locations
This commit is contained in:
Patrik Svensson
2021-07-12 09:39:20 +02:00
committed by Phil Scott
parent d532e1011f
commit fa5a1e88ec
114 changed files with 5 additions and 5 deletions

View File

@ -0,0 +1,108 @@
using System;
using System.Threading.Tasks;
using Spectre.Console.Testing;
using Spectre.Verify.Extensions;
using VerifyXunit;
using Xunit;
namespace Spectre.Console.Tests.Unit
{
[UsesVerify]
[ExpectationPath("Widgets/Calendar")]
public sealed class CalendarTests
{
[Fact]
[Expectation("Render")]
public Task Should_Render_Calendar_Correctly()
{
// Given
var console = new TestConsole();
var calendar = new Calendar(2020, 10)
.AddCalendarEvent(new DateTime(2020, 9, 1))
.AddCalendarEvent(new DateTime(2020, 10, 3))
.AddCalendarEvent(new DateTime(2020, 10, 12));
// When
console.Write(calendar);
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("Centered")]
public Task Should_Center_Calendar_Correctly()
{
// Given
var console = new TestConsole();
var calendar = new Calendar(2020, 10)
.Centered()
.AddCalendarEvent(new DateTime(2020, 9, 1))
.AddCalendarEvent(new DateTime(2020, 10, 3))
.AddCalendarEvent(new DateTime(2020, 10, 12));
// When
console.Write(calendar);
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("LeftAligned")]
public Task Should_Left_Align_Calendar_Correctly()
{
// Given
var console = new TestConsole();
var calendar = new Calendar(2020, 10)
.LeftAligned()
.AddCalendarEvent(new DateTime(2020, 9, 1))
.AddCalendarEvent(new DateTime(2020, 10, 3))
.AddCalendarEvent(new DateTime(2020, 10, 12));
// When
console.Write(calendar);
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("RightAligned")]
public Task Should_Right_Align_Calendar_Correctly()
{
// Given
var console = new TestConsole();
var calendar = new Calendar(2020, 10)
.RightAligned()
.AddCalendarEvent(new DateTime(2020, 9, 1))
.AddCalendarEvent(new DateTime(2020, 10, 3))
.AddCalendarEvent(new DateTime(2020, 10, 12));
// When
console.Write(calendar);
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("Culture")]
public Task Should_Render_Calendar_Correctly_For_Specific_Culture()
{
// Given
var console = new TestConsole();
var calendar = new Calendar(2020, 10, 15)
.Culture("de-DE")
.AddCalendarEvent(new DateTime(2020, 9, 1))
.AddCalendarEvent(new DateTime(2020, 10, 3))
.AddCalendarEvent(new DateTime(2020, 10, 12));
// When
console.Write(calendar);
// Then
return Verifier.Verify(console.Output);
}
}
}