Add an implicit operator to convert from Color to Style (#1160)

This commit is contained in:
Cédric Luthi
2023-05-10 15:20:12 +02:00
committed by GitHub
parent 3ec0fee795
commit 6acf9b8c63
16 changed files with 95 additions and 73 deletions

View File

@ -247,42 +247,42 @@ public sealed class TextPromptTests
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("SecretDefaultValueCustomMask")]
public Task Should_Choose_Custom_Masked_Default_Value_If_Nothing_Is_Entered_And_Prompt_Is_Secret_And_Mask_Is_Custom()
{
// Given
var console = new TestConsole();
console.Input.PushKey(ConsoleKey.Enter);
// When
console.Prompt(
new TextPrompt<string>("Favorite fruit?")
.Secret('-')
.DefaultValue("Banana"));
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("SecretDefaultValueNullMask")]
public Task Should_Choose_Empty_Masked_Default_Value_If_Nothing_Is_Entered_And_Prompt_Is_Secret_And_Mask_Is_Null()
{
// Given
var console = new TestConsole();
console.Input.PushKey(ConsoleKey.Enter);
// When
console.Prompt(
new TextPrompt<string>("Favorite fruit?")
.Secret(null)
.DefaultValue("Banana"));
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("SecretDefaultValueCustomMask")]
public Task Should_Choose_Custom_Masked_Default_Value_If_Nothing_Is_Entered_And_Prompt_Is_Secret_And_Mask_Is_Custom()
{
// Given
var console = new TestConsole();
console.Input.PushKey(ConsoleKey.Enter);
// When
console.Prompt(
new TextPrompt<string>("Favorite fruit?")
.Secret('-')
.DefaultValue("Banana"));
// Then
return Verifier.Verify(console.Output);
}
[Fact]
[Expectation("SecretDefaultValueNullMask")]
public Task Should_Choose_Empty_Masked_Default_Value_If_Nothing_Is_Entered_And_Prompt_Is_Secret_And_Mask_Is_Null()
{
// Given
var console = new TestConsole();
console.Input.PushKey(ConsoleKey.Enter);
// When
console.Prompt(
new TextPrompt<string>("Favorite fruit?")
.Secret(null)
.DefaultValue("Banana"));
// Then
return Verifier.Verify(console.Output);
}
[Fact]
@ -337,7 +337,7 @@ public sealed class TextPromptTests
var prompt = new TextPrompt<string>("Enter Value:")
.ShowDefaultValue()
.DefaultValue("default")
.DefaultValueStyle(new Style(foreground: Color.Red));
.DefaultValueStyle(Color.Red);
// When
console.Prompt(prompt);
@ -384,7 +384,7 @@ public sealed class TextPromptTests
.ShowChoices()
.AddChoice("Choice 1")
.AddChoice("Choice 2")
.ChoicesStyle(new Style(foreground: Color.Red));
.ChoicesStyle(Color.Red);
// When
console.Prompt(prompt);