diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs index 750f1c1c88..d23ef7fc48 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/AttributeRoutingTest.cs @@ -193,11 +193,13 @@ namespace Microsoft.AspNetCore.Mvc.Internal .SetupGet(o => o.Value) .Returns(new RouteOptions()); - return new ServiceCollection() + var services = new ServiceCollection() .AddSingleton(new DefaultInlineConstraintResolver(routeOptions.Object)) - .AddSingleton(new UrlTestEncoder()) - .AddRouting() - .AddSingleton(actionDescriptorProvider.Object) + .AddSingleton(new UrlTestEncoder()); + + services.AddRouting(); + + return services.AddSingleton(actionDescriptorProvider.Object) .AddSingleton(NullLoggerFactory.Instance) .BuildServiceProvider(); }