mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-12-22 17:45:49 +08:00
Moved analyzer tests to its own project
Also moves tests to `./test` which makes it possible for all test projects to share the same .editorconfig files and similar.
This commit is contained in:
54
test/Spectre.Console.Tests/Unit/RecorderTests.cs
Normal file
54
test/Spectre.Console.Tests/Unit/RecorderTests.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Threading.Tasks;
|
||||
using Spectre.Console.Testing;
|
||||
using Spectre.Verify.Extensions;
|
||||
using VerifyXunit;
|
||||
using Xunit;
|
||||
|
||||
namespace Spectre.Console.Tests.Unit
|
||||
{
|
||||
[UsesVerify]
|
||||
[ExpectationPath("Widgets/Recorder")]
|
||||
public sealed class RecorderTests
|
||||
{
|
||||
[Fact]
|
||||
[Expectation("Text")]
|
||||
public Task Should_Export_Text_As_Expected()
|
||||
{
|
||||
// Given
|
||||
var console = new TestConsole();
|
||||
var recorder = new Recorder(console);
|
||||
|
||||
recorder.Write(new Table()
|
||||
.AddColumns("Foo", "Bar", "Qux")
|
||||
.AddRow("Corgi", "Waldo", "Zap")
|
||||
.AddRow(new Panel("Hello World").RoundedBorder()));
|
||||
|
||||
// When
|
||||
var result = recorder.ExportText();
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Expectation("Html")]
|
||||
public Task Should_Export_Html_Text_As_Expected()
|
||||
{
|
||||
// Given
|
||||
var console = new TestConsole();
|
||||
var recorder = new Recorder(console);
|
||||
|
||||
recorder.Write(new Table()
|
||||
.AddColumns("[red on black]Foo[/]", "[green bold]Bar[/]", "[blue italic]Qux[/]")
|
||||
.AddRow("[invert underline]Corgi[/]", "[bold strikethrough]Waldo[/]", "[dim]Zap[/]")
|
||||
.AddRow(new Panel("[blue]Hello World[/]")
|
||||
.BorderColor(Color.Red).RoundedBorder()));
|
||||
|
||||
// When
|
||||
var result = recorder.ExportHtml();
|
||||
|
||||
// Then
|
||||
return Verifier.Verify(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user