File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -25,10 +25,26 @@ public void CanCorrectlyHandleDifferentAlternativeSwitchFormatsFoundInOneSingleT
2525 Assert . That ( bimseInstance . Switch , Is . EqualTo ( "value2" ) ) ;
2626 }
2727
28+ [ TestCase ( "-s:value2" ) ]
29+ [ TestCase ( "-s=value2" ) ]
30+ [ TestCase ( @"-s""value2""" ) ]
31+ public void CanCorrectlyHandleDifferentAlternativeSwitchFormatsFoundInOneSingleTokenOnly_Shortname ( string switchText )
32+ {
33+ var settings = new Settings ( ) ;
34+ var invoker = new CommandInvoker ( "bimse" , settings , new Bimse ( ) ) ;
35+ var arguments = Go . Parse ( new [ ] { switchText } , settings ) ;
36+
37+ invoker . Invoke ( arguments . Switches , EnvironmentSettings . Empty ) ;
38+
39+ var bimseInstance = ( Bimse ) invoker . CommandInstance ;
40+
41+ Assert . That ( bimseInstance . Switch , Is . EqualTo ( "value2" ) ) ;
42+ }
43+
2844 [ Command ( "bimse" ) ]
2945 class Bimse : ICommand
3046 {
31- [ Parameter ( "switch" ) ]
47+ [ Parameter ( "switch" , shortName : "s" ) ]
3248 public string Switch { get ; set ; }
3349
3450 public void Run ( )
Original file line number Diff line number Diff line change @@ -265,7 +265,7 @@ static bool CanBeResolvedFromEnvironmentSettings(EnvironmentSettings environment
265265
266266 static bool CanBeResolvedFromSwitches ( IEnumerable < Switch > switches , Parameter p )
267267 {
268- return switches . Any ( s => s . Key == p . Name ) ;
268+ return switches . Any ( s => p . MatchesKey ( s . Key ) ) ;
269269 }
270270 }
271271}
You can’t perform that action at this time.
0 commit comments