mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 05:18:16 +08:00
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:

committed by
Phil Scott

parent
d532e1011f
commit
fa5a1e88ec
108
test/Spectre.Console.Tests/Unit/Widgets/CalendarTests.cs
Normal file
108
test/Spectre.Console.Tests/Unit/Widgets/CalendarTests.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user