mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
Add tests for CommandInitializer that verify that short name comparison is case sensitive
This commit is contained in:
@@ -10,10 +10,13 @@ namespace CliFx.Tests.Services
|
||||
private class TestCommand : ICommand
|
||||
{
|
||||
[CommandOption("int", 'i', IsRequired = true)]
|
||||
public int IntOption { get; set; } = 24;
|
||||
public int Option1 { get; set; } = 24;
|
||||
|
||||
[CommandOption("str", 's')]
|
||||
public string StringOption { get; set; } = "foo bar";
|
||||
public string Option2 { get; set; } = "foo bar";
|
||||
|
||||
[CommandOption('S')]
|
||||
public bool Option3 { get; set; }
|
||||
|
||||
public Task ExecuteAsync(IConsole console) => Task.CompletedTask;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace CliFx.Tests.Services
|
||||
{
|
||||
new CommandOptionInput("int", "13")
|
||||
}),
|
||||
new TestCommand {IntOption = 13}
|
||||
new TestCommand {Option1 = 13}
|
||||
);
|
||||
|
||||
yield return new TestCaseData(
|
||||
@@ -35,7 +35,7 @@ namespace CliFx.Tests.Services
|
||||
new CommandOptionInput("int", "13"),
|
||||
new CommandOptionInput("str", "hello world")
|
||||
}),
|
||||
new TestCommand {IntOption = 13, StringOption = "hello world"}
|
||||
new TestCommand {Option1 = 13, Option2 = "hello world"}
|
||||
);
|
||||
|
||||
yield return new TestCaseData(
|
||||
@@ -45,7 +45,19 @@ namespace CliFx.Tests.Services
|
||||
{
|
||||
new CommandOptionInput("i", "13")
|
||||
}),
|
||||
new TestCommand {IntOption = 13}
|
||||
new TestCommand {Option1 = 13}
|
||||
);
|
||||
|
||||
yield return new TestCaseData(
|
||||
new TestCommand(),
|
||||
GetCommandSchema(typeof(TestCommand)),
|
||||
new CommandInput(new[]
|
||||
{
|
||||
new CommandOptionInput("i", "13"),
|
||||
new CommandOptionInput("s", "hello world"),
|
||||
new CommandOptionInput("S")
|
||||
}),
|
||||
new TestCommand {Option1 = 13, Option2 = "hello world", Option3 = true}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user