Improve the unit test around HideCompleted

This commit is contained in:
stf 2021-03-04 09:38:58 +01:00 committed by Phil Scott
parent 1c769c6610
commit ef08c5bf2b

View File

@ -189,7 +189,9 @@ namespace Spectre.Console.Tests.Unit
public void Should_Hide_Completed_Tasks()
{
// Given
var task = default(ProgressTask);
var taskFinished = default(ProgressTask);
var taskInProgress1 = default(ProgressTask);
var taskInProgress2 = default(ProgressTask);
var console = new FakeAnsiConsole(ColorSystem.TrueColor, width: 10);
var progress = new Progress(console)
@ -201,8 +203,11 @@ namespace Spectre.Console.Tests.Unit
// When
progress.Start(ctx =>
{
task = ctx.AddTask("foo");
task.Value = task.MaxValue;
taskInProgress1 = ctx.AddTask("foo");
taskFinished = ctx.AddTask("bar");
taskInProgress2 = ctx.AddTask("baz");
taskInProgress2.Increment(20);
taskFinished.Value = taskFinished.MaxValue;
});
// Then
@ -210,9 +215,10 @@ namespace Spectre.Console.Tests.Unit
.NormalizeLineEndings()
.ShouldBe(
"[?25l" + // Hide cursor
" \n" + // top padding
"…\n" + // hidden task
" \n" + // bottom padding
" \n" + // top padding
"━━━━━━━━━━\n" + // taskInProgress1
"━━━━━━━━━━\n" + // taskInProgress2
" \n" + // bottom padding
"[?25h"); // show cursor
}
}