React to quick cleanup in Routing
- `DefaultInlineConstraintResolver` has no need of a `IServiceProvider`
This commit is contained in:
parent
8e91c1ada6
commit
6524930778
|
|
@ -577,11 +577,8 @@ namespace Microsoft.AspNet.Mvc
|
||||||
.SetupGet(options => options.Options)
|
.SetupGet(options => options.Options)
|
||||||
.Returns(routeOptions);
|
.Returns(routeOptions);
|
||||||
|
|
||||||
// DefaultInlineConstraintResolver constructor does not currently check its serviceProvider parameter (e.g.
|
serviceCollection.AddInstance<IInlineConstraintResolver>(
|
||||||
// for null) and the class does not look up any services.
|
new DefaultInlineConstraintResolver(accessor.Object));
|
||||||
serviceCollection.AddInstance<IInlineConstraintResolver>(new DefaultInlineConstraintResolver(
|
|
||||||
serviceProvider: null,
|
|
||||||
routeOptions: accessor.Object));
|
|
||||||
|
|
||||||
return serviceCollection;
|
return serviceCollection;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1448,13 +1448,11 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
|
|
||||||
private static DefaultInlineConstraintResolver CreateConstraintResolver()
|
private static DefaultInlineConstraintResolver CreateConstraintResolver()
|
||||||
{
|
{
|
||||||
var services = Mock.Of<IServiceProvider>();
|
|
||||||
|
|
||||||
var options = new RouteOptions();
|
var options = new RouteOptions();
|
||||||
var optionsMock = new Mock<IOptions<RouteOptions>>();
|
var optionsMock = new Mock<IOptions<RouteOptions>>();
|
||||||
optionsMock.SetupGet(o => o.Options).Returns(options);
|
optionsMock.SetupGet(o => o.Options).Returns(options);
|
||||||
|
|
||||||
return new DefaultInlineConstraintResolver(services, optionsMock.Object);
|
return new DefaultInlineConstraintResolver(optionsMock.Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AttributeRoute CreateAttributeRoute(AttributeRouteLinkGenerationEntry entry)
|
private static AttributeRoute CreateAttributeRoute(AttributeRouteLinkGenerationEntry entry)
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ namespace Microsoft.AspNet.Mvc.Routing
|
||||||
|
|
||||||
services
|
services
|
||||||
.Setup(s => s.GetService(typeof(IInlineConstraintResolver)))
|
.Setup(s => s.GetService(typeof(IInlineConstraintResolver)))
|
||||||
.Returns(new DefaultInlineConstraintResolver(services.Object, routeOptions.Object));
|
.Returns(new DefaultInlineConstraintResolver(routeOptions.Object));
|
||||||
|
|
||||||
return services.Object;
|
return services.Object;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -716,8 +716,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
var accessorMock = new Mock<IOptions<RouteOptions>>();
|
var accessorMock = new Mock<IOptions<RouteOptions>>();
|
||||||
accessorMock.SetupGet(o => o.Options).Returns(new RouteOptions());
|
accessorMock.SetupGet(o => o.Options).Returns(new RouteOptions());
|
||||||
serviceProviderMock.Setup(o => o.GetService(typeof(IInlineConstraintResolver)))
|
serviceProviderMock.Setup(o => o.GetService(typeof(IInlineConstraintResolver)))
|
||||||
.Returns(new DefaultInlineConstraintResolver(serviceProviderMock.Object,
|
.Returns(new DefaultInlineConstraintResolver(accessorMock.Object));
|
||||||
accessorMock.Object));
|
|
||||||
|
|
||||||
rt.ServiceProvider = serviceProviderMock.Object;
|
rt.ServiceProvider = serviceProviderMock.Object;
|
||||||
rt.MapRoute(string.Empty,
|
rt.MapRoute(string.Empty,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue