Pipe character for listing options - Fully implemented and tested.

This commit is contained in:
Frank Ray
2024-03-18 13:03:19 +00:00
committed by Patrik Svensson
parent e66d3aab2e
commit 43f9ae92ad
11 changed files with 55 additions and 14 deletions

View File

@ -23,14 +23,16 @@ public sealed partial class CommandOptionAttributeTests
}
[Theory]
[InlineData("<VALUE>")]
public void Should_Parse_Value_Correctly(string value)
[InlineData("<VALUE>", "VALUE")]
[InlineData("<VALUE1>", "VALUE1")]
[InlineData("<VALUE1|VALUE2>", "VALUE1|VALUE2")]
public void Should_Parse_Value_Correctly(string value, string expected)
{
// Given, When
var option = new CommandOptionAttribute($"-o|--option {value}");
// Then
option.ValueName.ShouldBe("VALUE");
option.ValueName.ShouldBe(expected);
}
[Fact]

View File

@ -28,6 +28,27 @@ public sealed partial class CommandAppTests
return Verifier.Verify(result.Output);
}
[Fact]
[Expectation("Root_Command")]
public Task Should_Output_Root_Command_Correctly()
{
// Given
var fixture = new CommandAppTester();
fixture.Configure(configurator =>
{
configurator.SetApplicationName("myapp");
configurator.AddCommand<DogCommand>("dog");
configurator.AddCommand<HorseCommand>("horse");
configurator.AddCommand<GiraffeCommand>("giraffe");
});
// When
var result = fixture.Run("horse", "--help");
// Then
return Verifier.Verify(result.Output);
}
[Fact]
[Expectation("Hidden_Commands")]
public Task Should_Skip_Hidden_Commands()