1
1
namespace Microsoft . Web . Http . Description
2
2
{
3
3
using FluentAssertions ;
4
+ using Microsoft . Web . Http . Routing ;
4
5
using Microsoft . Web . Http . Versioning ;
5
6
using Moq ;
6
7
using System . Collections . ObjectModel ;
11
12
using System . Web . Http . Controllers ;
12
13
using System . Web . Http . Description ;
13
14
using System . Web . Http . Filters ;
15
+ using System . Web . Http . Routing ;
14
16
using Xunit ;
15
17
using static Microsoft . Web . Http . Versioning . ApiVersionParameterLocation ;
16
18
using static System . Web . Http . Description . ApiParameterSource ;
@@ -93,7 +95,12 @@ public void add_parameter_should_add_descriptor_for_path()
93
95
// arrange
94
96
var configuration = new HttpConfiguration ( ) ;
95
97
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
+ } ;
97
104
var version = new ApiVersion ( 1 , 0 ) ;
98
105
var options = new ApiExplorerOptions ( configuration ) ;
99
106
var context = new ApiVersionParameterDescriptionContext ( description , version , options ) ;
@@ -129,7 +136,12 @@ public void add_parameter_should_remove_other_descriptors_after_path_parameter_i
129
136
// arrange
130
137
var configuration = new HttpConfiguration ( ) ;
131
138
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
+ } ;
133
145
var version = new ApiVersion ( 1 , 0 ) ;
134
146
var options = new ApiExplorerOptions ( configuration ) ;
135
147
var context = new ApiVersionParameterDescriptionContext ( description , version , options ) ;
@@ -151,7 +163,12 @@ public void add_parameter_should_not_add_query_parameter_after_path_parameter_ha
151
163
// arrange
152
164
var configuration = new HttpConfiguration ( ) ;
153
165
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
+ } ;
155
172
var version = new ApiVersion ( 1 , 0 ) ;
156
173
var options = new ApiExplorerOptions ( configuration ) ;
157
174
var context = new ApiVersionParameterDescriptionContext ( description , version , options ) ;
0 commit comments