@@ -181,12 +181,17 @@ public void GetActions_ConventionallyRoutedAction_WithHttpConstraints()
181
181
var actionInfos = conventions . GetActions ( typeInfo . GetMethod ( actionName ) , typeInfo ) ;
182
182
183
183
// Assert
184
- var action = Assert . Single ( actionInfos ) ;
185
- Assert . Equal ( "Update" , action . ActionName ) ;
186
- Assert . True ( action . RequireActionNameMatch ) ;
187
- Assert . Equal ( new [ ] { "PUT" , "PATCH" } , action . HttpMethods ) ;
188
- Assert . Null ( action . AttributeRoute ) ;
189
- Assert . IsType < CustomHttpMethodsAttribute > ( Assert . Single ( action . Attributes ) ) ;
184
+ Assert . Equal ( 2 , actionInfos . Count ( ) ) ;
185
+ Assert . Single ( actionInfos , a => a . HttpMethods . Contains ( "PUT" ) ) ;
186
+ Assert . Single ( actionInfos , a => a . HttpMethods . Contains ( "PATCH" ) ) ;
187
+
188
+ foreach ( var action in actionInfos )
189
+ {
190
+ Assert . Equal ( "Update" , action . ActionName ) ;
191
+ Assert . True ( action . RequireActionNameMatch ) ;
192
+ Assert . Null ( action . AttributeRoute ) ;
193
+ Assert . IsType < CustomHttpMethodsAttribute > ( Assert . Single ( action . Attributes ) ) ;
194
+ }
190
195
}
191
196
192
197
[ Fact ]
@@ -224,15 +229,21 @@ public void GetActions_ConventionallyRoutedAction_WithMultipleHttpConstraints()
224
229
var actionInfos = conventions . GetActions ( typeInfo . GetMethod ( actionName ) , typeInfo ) ;
225
230
226
231
// Assert
227
- var action = Assert . Single ( actionInfos ) ;
228
- Assert . Equal ( "Details" , action . ActionName ) ;
229
- Assert . True ( action . RequireActionNameMatch ) ;
230
- Assert . Equal ( new [ ] { "GET" , "POST" } , action . HttpMethods . OrderBy ( m => m , StringComparer . Ordinal ) ) ;
231
- Assert . Null ( action . AttributeRoute ) ;
232
+ Assert . Equal ( 2 , actionInfos . Count ( ) ) ;
233
+ Assert . Single ( actionInfos , a => a . HttpMethods . Contains ( "GET" ) ) ;
234
+ Assert . Single ( actionInfos , a => a . HttpMethods . Contains ( "POST" ) ) ;
232
235
233
- Assert . Equal ( 2 , action . Attributes . Length ) ;
234
- Assert . Single ( action . Attributes , a => a is HttpGetAttribute ) ;
235
- Assert . Single ( action . Attributes , a => a is HttpPostAttribute ) ;
236
+ foreach ( var action in actionInfos )
237
+ {
238
+
239
+ Assert . Equal ( "Details" , action . ActionName ) ;
240
+ Assert . True ( action . RequireActionNameMatch ) ;
241
+ Assert . Null ( action . AttributeRoute ) ;
242
+
243
+ Assert . Equal ( 2 , action . Attributes . Length ) ;
244
+ Assert . Single ( action . Attributes , a => a is HttpGetAttribute ) ;
245
+ Assert . Single ( action . Attributes , a => a is HttpPostAttribute ) ;
246
+ }
236
247
}
237
248
238
249
[ Fact ]
@@ -247,16 +258,22 @@ public void GetActions_ConventionallyRoutedAction_WithMultipleOverlappingHttpCon
247
258
var actionInfos = conventions . GetActions ( typeInfo . GetMethod ( actionName ) , typeInfo ) ;
248
259
249
260
// Assert
250
- var action = Assert . Single ( actionInfos ) ;
251
- Assert . Equal ( "List" , action . ActionName ) ;
252
- Assert . True ( action . RequireActionNameMatch ) ;
253
- Assert . Equal ( new [ ] { "GET" , "POST" , "PUT" } , action . HttpMethods . OrderBy ( m => m , StringComparer . Ordinal ) ) ;
254
- Assert . Null ( action . AttributeRoute ) ;
261
+ Assert . Equal ( 3 , actionInfos . Count ( ) ) ;
262
+ Assert . Single ( actionInfos , a => a . HttpMethods . Contains ( "GET" ) ) ;
263
+ Assert . Single ( actionInfos , a => a . HttpMethods . Contains ( "POST" ) ) ;
264
+ Assert . Single ( actionInfos , a => a . HttpMethods . Contains ( "PUT" ) ) ;
255
265
256
- Assert . Equal ( 3 , action . Attributes . Length ) ;
257
- Assert . Single ( action . Attributes , a => a is HttpPutAttribute ) ;
258
- Assert . Single ( action . Attributes , a => a is HttpGetAttribute ) ;
259
- Assert . Single ( action . Attributes , a => a is AcceptVerbsAttribute ) ;
266
+ foreach ( var action in actionInfos )
267
+ {
268
+ Assert . Equal ( "List" , action . ActionName ) ;
269
+ Assert . True ( action . RequireActionNameMatch ) ;
270
+ Assert . Null ( action . AttributeRoute ) ;
271
+
272
+ Assert . Equal ( 3 , action . Attributes . Length ) ;
273
+ Assert . Single ( action . Attributes , a => a is HttpPutAttribute ) ;
274
+ Assert . Single ( action . Attributes , a => a is HttpGetAttribute ) ;
275
+ Assert . Single ( action . Attributes , a => a is AcceptVerbsAttribute ) ;
276
+ }
260
277
}
261
278
262
279
[ Fact ]
0 commit comments