@@ -1110,6 +1110,34 @@ public void Options_In_Group_With_No_Values_Generates_MissingGroupOptionError()
1110
1110
( ( NotParsed < Options_With_Group > ) result ) . Errors . Should ( ) . BeEquivalentTo ( expectedResult ) ;
1111
1111
}
1112
1112
1113
+ [ Fact ]
1114
+ public void Options_In_Group_With_No_Values_Generates_MissingGroupOptionErrors ( )
1115
+ {
1116
+ // Fixture setup
1117
+ var optionNames1 = new List < NameInfo >
1118
+ {
1119
+ new NameInfo ( "" , "option11" ) ,
1120
+ new NameInfo ( "" , "option12" )
1121
+ } ;
1122
+ var optionNames2 = new List < NameInfo >
1123
+ {
1124
+ new NameInfo ( "" , "option21" ) ,
1125
+ new NameInfo ( "" , "option22" )
1126
+ } ;
1127
+ var expectedResult = new [ ]
1128
+ {
1129
+ new MissingGroupOptionError ( "err-group" , optionNames1 ) ,
1130
+ new MissingGroupOptionError ( "err-group2" , optionNames2 )
1131
+ } ;
1132
+
1133
+ // Exercize system
1134
+ var result = InvokeBuild < Options_With_Multiple_Groups > (
1135
+ new [ ] { "-v 10.42" } ) ;
1136
+
1137
+ // Verify outcome
1138
+ ( ( NotParsed < Options_With_Multiple_Groups > ) result ) . Errors . Should ( ) . BeEquivalentTo ( expectedResult ) ;
1139
+ }
1140
+
1113
1141
[ Theory ]
1114
1142
[ InlineData ( "-v" , "10.5" , "--option1" , "test1" , "--option2" , "test2" ) ]
1115
1143
[ InlineData ( "-v" , "10.5" , "--option1" , "test1" ) ]
@@ -1164,6 +1192,35 @@ public void Options_In_Group_Ignore_Option_Group_If_Option_Group_Name_Empty()
1164
1192
errors . Should ( ) . BeEquivalentTo ( expectedResult ) ;
1165
1193
}
1166
1194
1195
+ [ Fact ]
1196
+ public void Options_In_Group_Use_Option_Default_Value_When_Available ( )
1197
+ {
1198
+ // Exercize system
1199
+ var result = InvokeBuild < Simple_Options_With_OptionGroup_WithOptionDefaultValue > ( new string [ ] { "-x" } ) ;
1200
+
1201
+ // Verify outcome
1202
+ result . Should ( ) . BeOfType < Parsed < Simple_Options_With_OptionGroup_WithOptionDefaultValue > > ( ) ;
1203
+ }
1204
+
1205
+ [ Fact ]
1206
+ public void Options_In_Group_Do_Not_Allow_Mutually_Exclusive_Set ( )
1207
+ {
1208
+ var expectedResult = new [ ]
1209
+ {
1210
+ new GroupOptionAmbiguityError ( new NameInfo ( "" , "stringvalue" ) ) ,
1211
+ new GroupOptionAmbiguityError ( new NameInfo ( "s" , "shortandlong" ) )
1212
+ } ;
1213
+
1214
+ // Exercize system
1215
+ var result = InvokeBuild < Simple_Options_With_OptionGroup_MutuallyExclusiveSet > ( new string [ ] { "-x" } ) ;
1216
+
1217
+ // Verify outcome
1218
+ result . Should ( ) . BeOfType < NotParsed < Simple_Options_With_OptionGroup_MutuallyExclusiveSet > > ( ) ;
1219
+ var errors = ( ( NotParsed < Simple_Options_With_OptionGroup_MutuallyExclusiveSet > ) result ) . Errors ;
1220
+
1221
+ errors . Should ( ) . BeEquivalentTo ( expectedResult ) ;
1222
+ }
1223
+
1167
1224
private class ValueWithNoSetterOptions
1168
1225
{
1169
1226
[ Value ( 0 , MetaName = "Test" , Default = 0 ) ]
0 commit comments