Add tests for CommandInitializer that verify that short name comparison is case sensitive

This commit is contained in:
Alexey Golub
2019-08-24 22:44:11 +03:00
parent fa05e4df3f
commit a94b2296e1
2 changed files with 20 additions and 5 deletions

View File

@@ -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;
}

View File

@@ -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}
);
}