File tree Expand file tree Collapse file tree
src/System.CommandLine.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1626,6 +1626,29 @@ public void When_option_arguments_are_greater_than_maximum_arity_then_an_error_i
16261626 . Contain ( LocalizationResources . UnrecognizedCommandOrArgument ( "4" ) ) ;
16271627 }
16281628
1629+ [ Fact ]
1630+ public void When_required_argument_is_missing_then_an_error_is_returned ( )
1631+ {
1632+ var command = new Command ( "the-command" )
1633+ {
1634+ new Argument < string > ( "arg0" ) ,
1635+ new Argument < string > ( "missing-arg1" ) ,
1636+ new Argument < string > ( "missing-arg2" )
1637+ } ;
1638+
1639+ var result = command . Parse ( "value-for-arg1" ) ;
1640+
1641+ result . Errors
1642+ . Select ( e => e . Message )
1643+ . Should ( )
1644+ . BeEquivalentTo (
1645+ // "Required argument 'missing-arg1' missing for command: 'the-command'."
1646+ LocalizationResources . RequiredArgumentMissing ( result . GetResult ( command . Arguments [ 1 ] ) ) ,
1647+ // "Required argument 'missing-arg2' missing for command: 'the-command'."
1648+ LocalizationResources . RequiredArgumentMissing ( result . GetResult ( command . Arguments [ 2 ] ) )
1649+ ) ;
1650+ }
1651+
16291652 [ Fact ]
16301653 public void Tokens_are_not_split_if_the_part_before_the_delimiter_is_not_an_option ( )
16311654 {
You can’t perform that action at this time.
0 commit comments