mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 13:28:16 +08:00

committed by
GitHub

parent
5f97f2300c
commit
d532e1011f
29
test/Spectre.Console.Tests/Unit/AnsiConsoleTests.Prompt.cs
Normal file
29
test/Spectre.Console.Tests/Unit/AnsiConsoleTests.Prompt.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Shouldly;
|
||||
using Spectre.Console.Testing;
|
||||
using Xunit;
|
||||
|
||||
namespace Spectre.Console.Tests.Unit
|
||||
{
|
||||
public partial class AnsiConsoleTests
|
||||
{
|
||||
public sealed class Prompt
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(true, true)]
|
||||
[InlineData(false, false)]
|
||||
public void Should_Return_Default_Value_If_Nothing_Is_Entered(bool expected, bool defaultValue)
|
||||
{
|
||||
// Given
|
||||
var console = new TestConsole().EmitAnsiSequences();
|
||||
console.Input.PushKey(ConsoleKey.Enter);
|
||||
|
||||
// When
|
||||
var result = console.Confirm("Want some prompt?", defaultValue);
|
||||
|
||||
// Then
|
||||
result.ShouldBe(expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user