Fix routing tests (#8718)
This commit is contained in:
parent
8308d94e39
commit
5ed7658bf2
|
|
@ -142,12 +142,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
string template)
|
||||
{
|
||||
var endpoints = GetDefaultEndpoints();
|
||||
endpoints.Add(new RouteEndpoint(
|
||||
httpContext => Task.CompletedTask,
|
||||
RoutePatternFactory.Parse(template),
|
||||
0,
|
||||
EndpointMetadataCollection.Empty,
|
||||
null));
|
||||
endpoints.Add(CreateEndpoint(template, routeName: routeName));
|
||||
return CreateUrlHelper(endpoints, appRoot, host, protocol);
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +176,7 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
string template,
|
||||
object defaults)
|
||||
{
|
||||
var endpoint = GetEndpoint(routeName, template, new RouteValueDictionary(defaults));
|
||||
var endpoint = CreateEndpoint(template, new RouteValueDictionary(defaults), routeName: routeName);
|
||||
var services = CreateServices(new[] { endpoint });
|
||||
var httpContext = CreateHttpContext(services, appRoot: "", host: null, protocol: null);
|
||||
var actionContext = CreateActionContext(httpContext);
|
||||
|
|
@ -262,13 +257,6 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
requiredValues: new { controller = "home", action = "contact" },
|
||||
order: 8,
|
||||
routeName: "namedroute"));
|
||||
endpoints.Add(
|
||||
CreateEndpoint(
|
||||
"any/url",
|
||||
defaults: new { },
|
||||
requiredValues: new { },
|
||||
order: 9,
|
||||
routeName: "MyRouteName"));
|
||||
endpoints.Add(
|
||||
CreateEndpoint(
|
||||
"api/orders/{id}",
|
||||
|
|
@ -315,15 +303,5 @@ namespace Microsoft.AspNetCore.Mvc.Routing
|
|||
services.TryAddSingleton<IUrlHelperFactory, UrlHelperFactory>();
|
||||
return services.BuildServiceProvider();
|
||||
}
|
||||
|
||||
private RouteEndpoint GetEndpoint(string name, string template, RouteValueDictionary defaults)
|
||||
{
|
||||
return new RouteEndpoint(
|
||||
c => Task.CompletedTask,
|
||||
RoutePatternFactory.Parse(template, defaults, parameterPolicies: null),
|
||||
0,
|
||||
EndpointMetadataCollection.Empty,
|
||||
null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue