File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
src/System.CommandLine.Tests/Binding Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -252,6 +252,28 @@ public async Task When_argument_type_is_not_known_until_binding_then_int_paramet
252
252
received . Should ( ) . Be ( 123 ) ;
253
253
}
254
254
255
+ [ Fact ]
256
+ public void When_argument_type_is_more_specific_than_parameter_type_then_parameter_is_bound_correctly ( )
257
+ {
258
+ FileSystemInfo received = null ;
259
+
260
+ var root = new RootCommand
261
+ {
262
+ new Option < DirectoryInfo > ( "-f" )
263
+ } ;
264
+ root . Handler = CommandHandler . Create < FileSystemInfo > ( f => received = f ) ;
265
+ var path = $ "{ Directory . GetCurrentDirectory ( ) } { Path . DirectorySeparatorChar } ";
266
+
267
+ root . Invoke ( $ "-f { path } ") ;
268
+
269
+ received . Should ( )
270
+ . BeOfType < DirectoryInfo > ( )
271
+ . Which
272
+ . FullName
273
+ . Should ( )
274
+ . Be ( path ) ;
275
+ }
276
+
255
277
[ Theory ]
256
278
[ InlineData ( typeof ( ClassWithCtorParameter < int > ) , false ) ]
257
279
[ InlineData ( typeof ( ClassWithCtorParameter < int > ) , true ) ]
You can’t perform that action at this time.
0 commit comments