@@ -302,10 +302,19 @@ public void AddsMultipleParameters()
302
302
Assert . Equal ( BindingSource . Body , fromBodyParam . Source ) ;
303
303
}
304
304
305
+ [ Fact ]
306
+ public void AddsDisplayNameFromRouteEndpoint ( )
307
+ {
308
+ var apiDescription = GetApiDescription ( ( ) => "foo" , displayName : "FOO" ) ;
309
+
310
+ Assert . Equal ( "FOO" , apiDescription . ActionDescriptor . DisplayName ) ;
311
+ }
312
+
305
313
private IList < ApiDescription > GetApiDescriptions (
306
314
Delegate action ,
307
315
string pattern = null ,
308
- IEnumerable < string > httpMethods = null )
316
+ IEnumerable < string > httpMethods = null ,
317
+ string displayName = null )
309
318
{
310
319
var methodInfo = action . Method ;
311
320
var attributes = methodInfo . GetCustomAttributes ( ) ;
@@ -316,7 +325,7 @@ private IList<ApiDescription> GetApiDescriptions(
316
325
var endpointMetadata = new EndpointMetadataCollection ( metadataItems . ToArray ( ) ) ;
317
326
var routePattern = RoutePatternFactory . Parse ( pattern ?? "/" ) ;
318
327
319
- var endpoint = new RouteEndpoint ( httpContext => Task . CompletedTask , routePattern , 0 , endpointMetadata , null ) ;
328
+ var endpoint = new RouteEndpoint ( httpContext => Task . CompletedTask , routePattern , 0 , endpointMetadata , displayName ) ;
320
329
var endpointDataSource = new DefaultEndpointDataSource ( endpoint ) ;
321
330
var hostEnvironment = new HostEnvironment
322
331
{
@@ -331,8 +340,8 @@ private IList<ApiDescription> GetApiDescriptions(
331
340
return context . Results ;
332
341
}
333
342
334
- private ApiDescription GetApiDescription ( Delegate action , string pattern = null ) =>
335
- Assert . Single ( GetApiDescriptions ( action , pattern ) ) ;
343
+ private ApiDescription GetApiDescription ( Delegate action , string pattern = null , string displayName = null ) =>
344
+ Assert . Single ( GetApiDescriptions ( action , pattern , displayName : displayName ) ) ;
336
345
337
346
private static void TestAction ( )
338
347
{
0 commit comments