Fix for breaking API change from routing
This commit is contained in:
parent
105c99cbf2
commit
0ccfcc4316
|
|
@ -18,7 +18,6 @@ namespace Microsoft.AspNet.Mvc.Core.Test.ActionResults
|
|||
httpContext.Setup(o => o.Response).Returns(httpResponse.Object);
|
||||
|
||||
var routeData = new RouteData();
|
||||
routeData.Values = new Dictionary<string, object>();
|
||||
routeData.Routers.Add(Mock.Of<IRouter>());
|
||||
|
||||
var actionContext = new ActionContext(httpContext.Object,
|
||||
|
|
|
|||
|
|
@ -97,10 +97,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
|
|||
|
||||
private static ActionContext GetActionContext(HttpContext httpContext)
|
||||
{
|
||||
var routeData = new RouteData()
|
||||
{
|
||||
Values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase),
|
||||
};
|
||||
var routeData = new RouteData();
|
||||
routeData.Routers.Add(new Mock<IRouter>().Object);
|
||||
|
||||
return new ActionContext(httpContext,
|
||||
|
|
|
|||
|
|
@ -137,7 +137,6 @@ namespace Microsoft.AspNet.Mvc
|
|||
private static IContextAccessor<ActionContext> CreateActionContext(HttpContext context, IRouter router)
|
||||
{
|
||||
var routeData = new RouteData();
|
||||
routeData.Values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||
routeData.Routers.Add(router);
|
||||
|
||||
var actionContext = new ActionContext(context,
|
||||
|
|
|
|||
|
|
@ -608,11 +608,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
// Arrange
|
||||
var routeContext = new RouteContext(GetHttpContext(verb));
|
||||
routeContext.RouteData.Values = new Dictionary<string, object>
|
||||
{
|
||||
{ "controller", "HttpMethodAttributeTests_RestOnly" },
|
||||
{ "action", "Patch" }
|
||||
};
|
||||
routeContext.RouteData.Values.Add("controller", "HttpMethodAttributeTests_RestOnly");
|
||||
routeContext.RouteData.Values.Add("action", "Patch");
|
||||
|
||||
// Act
|
||||
var result = await InvokeActionSelector(routeContext);
|
||||
|
|
@ -631,11 +628,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
// Arrange
|
||||
var routeContext = new RouteContext(GetHttpContext(verb));
|
||||
routeContext.RouteData.Values = new Dictionary<string, object>()
|
||||
{
|
||||
{ "controller", "HttpMethodAttributeTests_RestOnly" },
|
||||
{ "action", "Put" }
|
||||
};
|
||||
routeContext.RouteData.Values.Add("controller", "HttpMethodAttributeTests_RestOnly");
|
||||
routeContext.RouteData.Values.Add("action", "Put");
|
||||
|
||||
// Act
|
||||
var result = await InvokeActionSelector(routeContext);
|
||||
|
|
@ -652,10 +646,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
// Arrange
|
||||
// Note no action name is passed, hence should return a null action descriptor.
|
||||
var routeContext = new RouteContext(GetHttpContext(verb));
|
||||
routeContext.RouteData.Values = new Dictionary<string, object>()
|
||||
{
|
||||
{ "controller", "HttpMethodAttributeTests_RestOnly" },
|
||||
};
|
||||
routeContext.RouteData.Values.Add("controller", "HttpMethodAttributeTests_RestOnly");
|
||||
|
||||
// Act
|
||||
var result = await InvokeActionSelector(routeContext);
|
||||
|
|
@ -694,11 +685,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
// Arrange
|
||||
var routeContext = new RouteContext(GetHttpContext(verb));
|
||||
routeContext.RouteData.Values = new Dictionary<string, object>
|
||||
{
|
||||
{ "controller", "ActionName" },
|
||||
{ "action", "RPCMethodWithHttpGet" }
|
||||
};
|
||||
routeContext.RouteData.Values.Add("controller", "ActionName");
|
||||
routeContext.RouteData.Values.Add("action", "RPCMethodWithHttpGet");
|
||||
|
||||
// Act
|
||||
var result = await InvokeActionSelector(routeContext);
|
||||
|
|
@ -727,11 +715,8 @@ namespace Microsoft.AspNet.Mvc
|
|||
{
|
||||
// Arrange
|
||||
var routeContext = new RouteContext(GetHttpContext(verb));
|
||||
routeContext.RouteData.Values = new Dictionary<string, object>
|
||||
{
|
||||
{ "controller", "ActionName" },
|
||||
{ "action", actionName }
|
||||
};
|
||||
routeContext.RouteData.Values.Add("controller", "ActionName");
|
||||
routeContext.RouteData.Values.Add("action", actionName);
|
||||
|
||||
// Act
|
||||
var result = await InvokeActionSelector(routeContext);
|
||||
|
|
@ -865,11 +850,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
|
||||
private static RouteContext CreateRouteContext(string httpMethod)
|
||||
{
|
||||
var routeData = new RouteData()
|
||||
{
|
||||
Values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase),
|
||||
};
|
||||
|
||||
var routeData = new RouteData();
|
||||
routeData.Routers.Add(new Mock<IRouter>(MockBehavior.Strict).Object);
|
||||
|
||||
var httpContext = new Mock<HttpContext>(MockBehavior.Strict);
|
||||
|
|
|
|||
|
|
@ -569,7 +569,6 @@ namespace Microsoft.AspNet.Mvc.Core.Test
|
|||
private static IContextAccessor<ActionContext> CreateActionContext(HttpContext context, IRouter router)
|
||||
{
|
||||
var routeData = new RouteData();
|
||||
routeData.Values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||
routeData.Routers.Add(router);
|
||||
|
||||
var actionContext = new ActionContext(context,
|
||||
|
|
|
|||
|
|
@ -115,10 +115,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
|||
public static ActionContext GetActionContext(string controller = "mycontroller",
|
||||
string area = null)
|
||||
{
|
||||
var routeData = new RouteData
|
||||
{
|
||||
Values = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
|
||||
};
|
||||
var routeData = new RouteData();
|
||||
routeData.Values["controller"] = controller;
|
||||
if (area != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -461,7 +461,13 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
|
|||
.Returns(razorView ?? Mock.Of<IRazorView>());
|
||||
|
||||
httpContext.RequestServices = serviceProvider.Object;
|
||||
var routeData = new RouteData { Values = routeValues };
|
||||
|
||||
var routeData = new RouteData();
|
||||
foreach (var kvp in routeValues)
|
||||
{
|
||||
routeData.Values.Add(kvp.Key, kvp.Value);
|
||||
}
|
||||
|
||||
return new ActionContext(httpContext, routeData, new ActionDescriptor());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -511,10 +511,12 @@ namespace Microsoft.AspNet.Mvc.WebApiCompatShim
|
|||
}
|
||||
|
||||
var routeContext = new RouteContext(httpContext);
|
||||
routeContext.RouteData = new RouteData()
|
||||
routeContext.RouteData = new RouteData();
|
||||
|
||||
foreach (var kvp in new RouteValueDictionary(routeValues))
|
||||
{
|
||||
Values = new RouteValueDictionary(routeValues),
|
||||
};
|
||||
routeContext.RouteData.Values.Add(kvp.Key, kvp.Value);
|
||||
}
|
||||
|
||||
return routeContext;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue