public string ToString(Indent indent) { return($"{nameof(ParseResult)}:{NewLine}" + $"{indent}{nameof(TargetCommand)}:{TargetCommand}{NewLine}" + $"{indent}{nameof(RemainingOperands)}:{RemainingOperands.ToCsv()}{NewLine}" + $"{indent}{nameof(SeparatedArguments)}:{SeparatedArguments.ToCsv()}{NewLine}" + $"{indent}{nameof(ParseError)}:{ParseError?.Message}"); }
public void Given_EndOfOptions_When_Separator_OperandValueWithDash_OperandsAreParsed() { var result = new AppRunner <Math>(_endOfOptionsSettings) .Verify(new Scenario { When = { Args = "Concat -- -a -b" }, Then = { Output = "-a-b" } }); result.CommandContext.ParseResult !.SeparatedArguments .Should().BeEquivalentTo("-a", "-b"); }
public void Given_EndOfOptions_And_IgnoreUnexpected_Enabled_When_Separator_OperandValueWithDash_OperandsAreParsed_And_ExtraArgsAreIgnoredAndCaptured() { var appSettings = _endOfOptionsSettings.Clone(s => s.IgnoreUnexpectedOperands = true); var result = new AppRunner <Math>(appSettings) .Verify(new Scenario { When = { Args = "Concat -- -a -b -c -d" }, Then = { Output = "-a-b" } }); result.CommandContext.ParseResult !.RemainingOperands .Should().BeEquivalentTo("-c", "-d"); result.CommandContext.ParseResult !.SeparatedArguments .Should().BeEquivalentTo("-a", "-b", "-c", "-d"); }
public void CmdDotNet_Examples_Alternative3_IsValid() { // test examples in the help documentation var appSettings = _endOfOptionsSettings.Clone(s => s.IgnoreUnexpectedOperands = true); var result = new AppRunner <Math>(appSettings) .Verify(new Scenario { When = { Args = "Concat -- -a -b __ -c -d" }, Then = { Output = "-a-b" } }); result.CommandContext.ParseResult !.RemainingOperands .Should().BeEquivalentTo("__", "-c", "-d"); result.CommandContext.ParseResult !.SeparatedArguments .Should().BeEquivalentTo("-a", "-b", "__", "-c", "-d"); }