11namespace Microsoft . Web . Http . Description
22{
33 using FluentAssertions ;
4+ using Microsoft . Web . Http . Routing ;
45 using Microsoft . Web . Http . Versioning ;
56 using Moq ;
67 using System . Collections . ObjectModel ;
1112 using System . Web . Http . Controllers ;
1213 using System . Web . Http . Description ;
1314 using System . Web . Http . Filters ;
15+ using System . Web . Http . Routing ;
1416 using Xunit ;
1517 using static Microsoft . Web . Http . Versioning . ApiVersionParameterLocation ;
1618 using static System . Web . Http . Description . ApiParameterSource ;
@@ -93,7 +95,12 @@ public void add_parameter_should_add_descriptor_for_path()
9395 // arrange
9496 var configuration = new HttpConfiguration ( ) ;
9597 var action = NewActionDescriptor ( ) ;
96- var description = new ApiDescription ( ) { ActionDescriptor = action } ;
98+ var route = new HttpRoute ( ) { Constraints = { [ "api-version" ] = new ApiVersionRouteConstraint ( ) } } ;
99+ var description = new ApiDescription ( )
100+ {
101+ ActionDescriptor = action ,
102+ Route = route ,
103+ } ;
97104 var version = new ApiVersion ( 1 , 0 ) ;
98105 var options = new ApiExplorerOptions ( configuration ) ;
99106 var context = new ApiVersionParameterDescriptionContext ( description , version , options ) ;
@@ -129,7 +136,12 @@ public void add_parameter_should_remove_other_descriptors_after_path_parameter_i
129136 // arrange
130137 var configuration = new HttpConfiguration ( ) ;
131138 var action = NewActionDescriptor ( ) ;
132- var description = new ApiDescription ( ) { ActionDescriptor = action } ;
139+ var route = new HttpRoute ( ) { Constraints = { [ "api-version" ] = new ApiVersionRouteConstraint ( ) } } ;
140+ var description = new ApiDescription ( )
141+ {
142+ ActionDescriptor = action ,
143+ Route = route ,
144+ } ;
133145 var version = new ApiVersion ( 1 , 0 ) ;
134146 var options = new ApiExplorerOptions ( configuration ) ;
135147 var context = new ApiVersionParameterDescriptionContext ( description , version , options ) ;
@@ -151,7 +163,12 @@ public void add_parameter_should_not_add_query_parameter_after_path_parameter_ha
151163 // arrange
152164 var configuration = new HttpConfiguration ( ) ;
153165 var action = NewActionDescriptor ( ) ;
154- var description = new ApiDescription ( ) { ActionDescriptor = action } ;
166+ var route = new HttpRoute ( ) { Constraints = { [ "api-version" ] = new ApiVersionRouteConstraint ( ) } } ;
167+ var description = new ApiDescription ( )
168+ {
169+ ActionDescriptor = action ,
170+ Route = route ,
171+ } ;
155172 var version = new ApiVersion ( 1 , 0 ) ;
156173 var options = new ApiExplorerOptions ( configuration ) ;
157174 var context = new ApiVersionParameterDescriptionContext ( description , version , options ) ;
0 commit comments