File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
src/Mvc/Mvc.ApiExplorer/test Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -767,6 +767,33 @@ static void AssertPathParameter(ApiDescription apiDescription)
767767 AssertPathParameter ( GetApiDescription ( ( TryParseStringRecordStruct foo ) => { } , "/{foo}" ) ) ;
768768 }
769769
770+ [ Fact ]
771+ public void AddsFromRouteParameterAsPathWhenOmittedInHandler ( )
772+ {
773+ static void AssertPathParameter ( ApiDescription apiDescription )
774+ {
775+ var param = Assert . Single ( apiDescription . ParameterDescriptions ) ;
776+ Assert . Equal ( "foo" , param . Name ) ;
777+ Assert . Equal ( BindingSource . Path , param . Source ) ;
778+ }
779+
780+ AssertPathParameter ( GetApiDescription ( ( ) => { } , "/{foo}" ) ) ;
781+ }
782+
783+ [ Fact ]
784+ public void AddsFromRouteParameterAsPathOnceRegardlessOfCasing ( )
785+ {
786+ static void AssertPathParameter ( ApiDescription apiDescription )
787+ {
788+ var param = Assert . Single ( apiDescription . ParameterDescriptions ) ;
789+ Assert . Equal ( typeof ( int ) , param . Type ) ;
790+ Assert . Equal ( typeof ( int ) , param . ModelMetadata . ModelType ) ;
791+ Assert . Equal ( BindingSource . Path , param . Source ) ;
792+ }
793+
794+ AssertPathParameter ( GetApiDescription ( ( int foo ) => { } , "/{FOO}" ) ) ;
795+ }
796+
770797 [ Fact ]
771798 public void AddsFromQueryParameterAsQuery ( )
772799 {
You can’t perform that action at this time.
0 commit comments