mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-25 20:52:50 +08:00
50 lines
1.1 KiB
C#
50 lines
1.1 KiB
C#
namespace Spectre.Console.Tests.Unit;
|
|
|
|
[ExpectationPath("Widgets/ProgressBar")]
|
|
public class ProgressBarTests
|
|
{
|
|
[Fact]
|
|
[Expectation("Render")]
|
|
public async Task Should_Render_Correctly()
|
|
{
|
|
// Given
|
|
var console = new TestConsole();
|
|
|
|
var bar = new ProgressBar()
|
|
{
|
|
Width = 60,
|
|
Value = 9000,
|
|
MaxValue = 9000,
|
|
ShowValue = true,
|
|
};
|
|
|
|
// When
|
|
console.Write(bar);
|
|
|
|
// Then
|
|
await Verifier.Verify(console.Output);
|
|
}
|
|
|
|
[Fact]
|
|
[Expectation("Formatted")]
|
|
public async Task Should_Render_ValueFormatted()
|
|
{
|
|
// Given
|
|
var console = new TestConsole();
|
|
|
|
var bar = new ProgressBar()
|
|
{
|
|
Width = 60,
|
|
Value = 9000,
|
|
MaxValue = 9000,
|
|
ShowValue = true,
|
|
ValueFormatter = (value, _) => value.ToString("N0", CultureInfo.InvariantCulture),
|
|
};
|
|
|
|
// When
|
|
console.Write(bar);
|
|
|
|
// Then
|
|
await Verifier.Verify(console.Output);
|
|
}
|
|
} |