@@ -30,6 +30,19 @@ private static ParserResult<T> InvokeBuild<T>(string[] arguments)
30
30
Enumerable . Empty < ErrorType > ( ) ) ;
31
31
}
32
32
33
+ private static ParserResult < T > InvokeBuildEnumValuesCaseIgnore < T > ( string [ ] arguments )
34
+ where T : new ( )
35
+ {
36
+ return InstanceBuilder . Build (
37
+ Maybe . Just < Func < T > > ( ( ) => new T ( ) ) ,
38
+ ( args , optionSpecs ) => Tokenizer . ConfigureTokenizer ( StringComparer . Ordinal , false , false ) ( args , optionSpecs ) ,
39
+ arguments ,
40
+ StringComparer . Ordinal ,
41
+ true ,
42
+ CultureInfo . InvariantCulture ,
43
+ Enumerable . Empty < ErrorType > ( ) ) ;
44
+ }
45
+
33
46
private static ParserResult < T > InvokeBuildImmutable < T > ( string [ ] arguments )
34
47
{
35
48
return InstanceBuilder . Build (
@@ -261,6 +274,27 @@ public void Parse_enum_value(string[] arguments, Colors expected)
261
274
// Teardown
262
275
}
263
276
277
+ [ Theory ]
278
+ [ InlineData ( new [ ] { "--colors" , "red" } , Colors . Red ) ]
279
+ [ InlineData ( new [ ] { "--colors" , "green" } , Colors . Green ) ]
280
+ [ InlineData ( new [ ] { "--colors" , "blue" } , Colors . Blue ) ]
281
+ [ InlineData ( new [ ] { "--colors" , "0" } , Colors . Red ) ]
282
+ [ InlineData ( new [ ] { "--colors" , "1" } , Colors . Green ) ]
283
+ [ InlineData ( new [ ] { "--colors" , "2" } , Colors . Blue ) ]
284
+ public void Parse_enum_value_ignore_case ( string [ ] arguments , Colors expected )
285
+ {
286
+ // Fixture setup in attribute
287
+
288
+ // Exercize system
289
+ var result = InvokeBuildEnumValuesCaseIgnore < Simple_Options_With_Enum > (
290
+ arguments ) ;
291
+
292
+ // Verify outcome
293
+ expected . ShouldBeEquivalentTo ( ( ( Parsed < Simple_Options_With_Enum > ) result ) . Value . Colors ) ;
294
+
295
+ // Teardown
296
+ }
297
+
264
298
[ Fact ]
265
299
public void Parse_enum_value_with_wrong_index_generates_BadFormatConversionError ( )
266
300
{
0 commit comments