@@ -301,7 +301,8 @@ public async Task Handler_method_receives_option_arguments_bound_to_the_specifie
301301 } ;
302302 command . Handler = handler ;
303303
304- var parseResult = command . Parse ( $ "--value { testCase . CommandLine } ") ;
304+ var commandLine = string . Join ( " " , testCase . CommandLineTokens . Select ( t => $ "--value { t } ") ) ;
305+ var parseResult = command . Parse ( commandLine ) ;
305306
306307 var invocationContext = new InvocationContext ( parseResult ) ;
307308
@@ -350,11 +351,11 @@ public async Task When_binding_fails_due_to_parameter_naming_mismatch_then_handl
350351 public async Task Handler_method_receives_command_arguments_bound_to_the_specified_type (
351352 Type type )
352353 {
353- var c = BindingCases [ type ] ;
354+ var testCase = BindingCases [ type ] ;
354355
355356 var captureMethod = GetType ( )
356357 . GetMethod ( nameof ( CaptureMethod ) , BindingFlags . NonPublic | BindingFlags . Static )
357- . MakeGenericMethod ( c . ParameterType ) ;
358+ . MakeGenericMethod ( testCase . ParameterType ) ;
358359
359360 var handler = CommandHandler . Create ( captureMethod ) ;
360361
@@ -364,22 +365,23 @@ public async Task Handler_method_receives_command_arguments_bound_to_the_specifi
364365 new Argument
365366 {
366367 Name = "value" ,
367- ArgumentType = c . ParameterType
368+ ArgumentType = testCase . ParameterType
368369 }
369370 } ;
370371 command . Handler = handler ;
371372
372- var parseResult = command . Parse ( c . CommandLine ) ;
373+ var commandLine = string . Join ( " " , testCase . CommandLineTokens ) ;
374+ var parseResult = command . Parse ( commandLine ) ;
373375
374376 var invocationContext = new InvocationContext ( parseResult ) ;
375377
376378 await handler . InvokeAsync ( invocationContext ) ;
377379
378380 var boundValue = ( ( BoundValueCapturer ) invocationContext . InvocationResult ) . BoundValue ;
379381
380- boundValue . Should ( ) . BeOfType ( c . ParameterType ) ;
382+ boundValue . Should ( ) . BeOfType ( testCase . ParameterType ) ;
381383
382- c . AssertBoundValue ( boundValue ) ;
384+ testCase . AssertBoundValue ( boundValue ) ;
383385 }
384386
385387 [ Theory ]
@@ -398,19 +400,19 @@ public async Task Handler_method_receives_command_arguments_bound_to_the_specifi
398400 public async Task Handler_method_receives_command_arguments_explicitly_bound_to_the_specified_type (
399401 Type type )
400402 {
401- var c = BindingCases [ type ] ;
403+ var testCase = BindingCases [ type ] ;
402404
403405 var captureMethod = GetType ( )
404406 . GetMethod ( nameof ( CaptureMethod ) , BindingFlags . NonPublic | BindingFlags . Static )
405- . MakeGenericMethod ( c . ParameterType ) ;
407+ . MakeGenericMethod ( testCase . ParameterType ) ;
406408 var parameter = captureMethod . GetParameters ( ) [ 0 ] ;
407409
408410 var handler = CommandHandler . Create ( captureMethod ) ;
409411
410412 var argument = new Argument
411413 {
412414 Name = "value" ,
413- ArgumentType = c . ParameterType
415+ ArgumentType = testCase . ParameterType
414416 } ;
415417
416418 var command = new Command (
@@ -425,17 +427,18 @@ public async Task Handler_method_receives_command_arguments_explicitly_bound_to_
425427 bindingHandler . BindParameter ( parameter , argument ) ;
426428 command . Handler = handler ;
427429
428- var parseResult = command . Parse ( c . CommandLine ) ;
430+ var commandLine = string . Join ( " " , testCase . CommandLineTokens ) ;
431+ var parseResult = command . Parse ( commandLine ) ;
429432
430433 var invocationContext = new InvocationContext ( parseResult ) ;
431434
432435 await handler . InvokeAsync ( invocationContext ) ;
433436
434437 var boundValue = ( ( BoundValueCapturer ) invocationContext . InvocationResult ) . BoundValue ;
435438
436- boundValue . Should ( ) . BeOfType ( c . ParameterType ) ;
439+ boundValue . Should ( ) . BeOfType ( testCase . ParameterType ) ;
437440
438- c . AssertBoundValue ( boundValue ) ;
441+ testCase . AssertBoundValue ( boundValue ) ;
439442 }
440443
441444 [ Theory ]
@@ -455,16 +458,16 @@ public async Task Handler_method_receives_command_arguments_explicitly_bound_to_
455458 public async Task Handler_method_receive_option_arguments_explicitly_bound_to_the_specified_type (
456459 Type type )
457460 {
458- var c = BindingCases [ type ] ;
461+ var testCase = BindingCases [ type ] ;
459462
460463 var captureMethod = GetType ( )
461464 . GetMethod ( nameof ( CaptureMethod ) , BindingFlags . NonPublic | BindingFlags . Static )
462- . MakeGenericMethod ( c . ParameterType ) ;
465+ . MakeGenericMethod ( testCase . ParameterType ) ;
463466 var parameter = captureMethod . GetParameters ( ) [ 0 ] ;
464467
465468 var handler = CommandHandler . Create ( captureMethod ) ;
466469
467- var option = new Option ( "--value" , argumentType : c . ParameterType ) ;
470+ var option = new Option ( "--value" , argumentType : testCase . ParameterType ) ;
468471
469472 var command = new Command ( "command" )
470473 {
@@ -477,7 +480,7 @@ public async Task Handler_method_receive_option_arguments_explicitly_bound_to_th
477480 bindingHandler . BindParameter ( parameter , option ) ;
478481 command . Handler = handler ;
479482
480- var commandLine = $ "--value { c . CommandLine } " ;
483+ var commandLine = string . Join ( " " , testCase . CommandLineTokens . Select ( t => $ "--value { t } " ) ) ;
481484 var parseResult = command . Parse ( commandLine ) ;
482485
483486 var invocationContext = new InvocationContext ( parseResult ) ;
@@ -486,9 +489,9 @@ public async Task Handler_method_receive_option_arguments_explicitly_bound_to_th
486489
487490 var boundValue = ( ( BoundValueCapturer ) invocationContext . InvocationResult ) . BoundValue ;
488491
489- boundValue . Should ( ) . BeOfType ( c . ParameterType ) ;
492+ boundValue . Should ( ) . BeOfType ( testCase . ParameterType ) ;
490493
491- c . AssertBoundValue ( boundValue ) ;
494+ testCase . AssertBoundValue ( boundValue ) ;
492495 }
493496
494497 private static void CaptureMethod < T > ( T value , InvocationContext invocationContext )
@@ -550,7 +553,10 @@ public void Apply(InvocationContext context)
550553 . Be ( Path . Combine ( ExistingDirectory ( ) , "file1.txt" ) ) ) ,
551554
552555 BindingTestCase . Create < FileInfo [ ] > (
553- $ "{ Path . Combine ( ExistingDirectory ( ) , "file1.txt" ) } { Path . Combine ( ExistingDirectory ( ) , "file2.txt" ) } ",
556+ new [ ] {
557+ Path . Combine ( ExistingDirectory ( ) , "file1.txt" ) ,
558+ Path . Combine ( ExistingDirectory ( ) , "file2.txt" )
559+ } ,
554560 o => o . Select ( f => f . FullName )
555561 . Should ( )
556562 . BeEquivalentTo ( new [ ]
@@ -569,17 +575,17 @@ public void Apply(InvocationContext context)
569575 . Be ( ExistingDirectory ( ) ) ) ,
570576
571577 BindingTestCase . Create < DirectoryInfo [ ] > (
572- $ " { ExistingDirectory ( ) } { ExistingDirectory ( ) } " ,
578+ new [ ] { ExistingDirectory ( ) , ExistingDirectory ( ) } ,
573579 fsi => fsi . Should ( )
574- . BeAssignableTo < IEnumerable < DirectoryInfo > > ( )
575- . Which
576- . Select ( d => d . FullName )
577- . Should ( )
578- . BeEquivalentTo ( new [ ]
579- {
580- ExistingDirectory ( ) ,
581- ExistingDirectory ( )
582- } ) ) ,
580+ . BeAssignableTo < IEnumerable < DirectoryInfo > > ( )
581+ . Which
582+ . Select ( d => d . FullName )
583+ . Should ( )
584+ . BeEquivalentTo ( new [ ]
585+ {
586+ ExistingDirectory ( ) ,
587+ ExistingDirectory ( )
588+ } ) ) ,
583589
584590 BindingTestCase . Create < FileSystemInfo > (
585591 ExistingFile ( ) ,
@@ -633,19 +639,19 @@ public void Apply(InvocationContext context)
633639 variationName : nameof ( NonexistentPathWithoutTrailingSlash ) ) ,
634640
635641 BindingTestCase . Create < string [ ] > (
636- "one two" ,
642+ new [ ] { "one" , " two" } ,
637643 o => o . Should ( ) . BeEquivalentTo ( new [ ] { "one" , "two" } ) ) ,
638644
639645 BindingTestCase . Create < List < string > > (
640- "one two" ,
646+ new [ ] { "one" , " two" } ,
641647 o => o . Should ( ) . BeEquivalentTo ( new List < string > { "one" , "two" } ) ) ,
642648
643649 BindingTestCase . Create < int [ ] > (
644- "1 2" ,
650+ new [ ] { "1" , "2" } ,
645651 o => o . Should ( ) . BeEquivalentTo ( new [ ] { 1 , 2 } ) ) ,
646652
647653 BindingTestCase . Create < List < int > > (
648- "1 2" ,
654+ new [ ] { "1" , "2" } ,
649655 o => o . Should ( ) . BeEquivalentTo ( new List < int > { 1 , 2 } ) )
650656 } ;
651657
0 commit comments