Mvc Changes corresponding to Routing DI changes. Refer pr#63
This commit is contained in:
parent
6d78f8adb3
commit
dd3dafddb8
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.Framework.ConfigurationModel;
|
using Microsoft.Framework.ConfigurationModel;
|
||||||
|
|
||||||
namespace Microsoft.Framework.DependencyInjection
|
namespace Microsoft.Framework.DependencyInjection
|
||||||
|
|
@ -10,11 +11,13 @@ namespace Microsoft.Framework.DependencyInjection
|
||||||
{
|
{
|
||||||
public static IServiceCollection AddMvc(this IServiceCollection services)
|
public static IServiceCollection AddMvc(this IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
services.Add(RoutingServices.GetDefaultServices());
|
||||||
return services.Add(MvcServices.GetDefaultServices());
|
return services.Add(MvcServices.GetDefaultServices());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IServiceCollection AddMvc(this IServiceCollection services, IConfiguration configuration)
|
public static IServiceCollection AddMvc(this IServiceCollection services, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
|
services.Add(RoutingServices.GetDefaultServices());
|
||||||
return services.Add(MvcServices.GetDefaultServices(configuration));
|
return services.Add(MvcServices.GetDefaultServices(configuration));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Routing;
|
using Microsoft.AspNet.Routing;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
|
using Microsoft.Framework.OptionsModel;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -535,8 +536,12 @@ namespace Microsoft.AspNet.Mvc.Core.Test
|
||||||
.Returns<VirtualPathContext>(rc => null);
|
.Returns<VirtualPathContext>(rc => null);
|
||||||
rt.DefaultHandler = target.Object;
|
rt.DefaultHandler = target.Object;
|
||||||
var serviceProviderMock = new Mock<IServiceProvider>();
|
var serviceProviderMock = new Mock<IServiceProvider>();
|
||||||
|
var accessorMock = new Mock<IOptionsAccessor<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());
|
.Returns(new DefaultInlineConstraintResolver(serviceProviderMock.Object,
|
||||||
|
accessorMock.Object));
|
||||||
|
|
||||||
rt.ServiceProvider = serviceProviderMock.Object;
|
rt.ServiceProvider = serviceProviderMock.Object;
|
||||||
rt.MapRoute(string.Empty,
|
rt.MapRoute(string.Empty,
|
||||||
"{controller}/{action}/{id}",
|
"{controller}/{action}/{id}",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue