Fixing tests, created constants
This commit is contained in:
@@ -9,6 +9,7 @@ using Umbraco.Core.Logging;
|
||||
using Umbraco.Web.Common.Routing;
|
||||
using Umbraco.Web.Website.Controllers;
|
||||
using Umbraco.Web.Website.Routing;
|
||||
using static Umbraco.Core.Constants.Web.Routing;
|
||||
|
||||
namespace Umbraco.Web.Website.ActionResults
|
||||
{
|
||||
@@ -39,8 +40,8 @@ namespace Umbraco.Web.Website.ActionResults
|
||||
}
|
||||
|
||||
// Change the route values back to the original request vals
|
||||
context.RouteData.Values[UmbracoRouteValueTransformer.ControllerToken] = umbracoRouteValues.ControllerName;
|
||||
context.RouteData.Values[UmbracoRouteValueTransformer.ActionToken] = umbracoRouteValues.ActionName;
|
||||
context.RouteData.Values[ControllerToken] = umbracoRouteValues.ControllerName;
|
||||
context.RouteData.Values[ActionToken] = umbracoRouteValues.ActionName;
|
||||
|
||||
// Create a new context and excute the original controller...
|
||||
// Copy the action context - this also copies the ModelState
|
||||
|
||||
@@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Routing;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Web.Common.Controllers;
|
||||
using static Umbraco.Core.Constants.Web.Routing;
|
||||
|
||||
namespace Umbraco.Web.Website.Routing
|
||||
{
|
||||
@@ -58,8 +59,8 @@ namespace Umbraco.Web.Website.Routing
|
||||
// Use aspnetcore's IActionSelector to do the finding since it uses an optimized cache lookup
|
||||
var routeValues = new RouteValueDictionary
|
||||
{
|
||||
[UmbracoRouteValueTransformer.ControllerToken] = customControllerName,
|
||||
[UmbracoRouteValueTransformer.ActionToken] = customActionName, // first try to find the custom action
|
||||
[ControllerToken] = customControllerName,
|
||||
[ActionToken] = customActionName, // first try to find the custom action
|
||||
};
|
||||
var routeData = new RouteData(routeValues);
|
||||
var routeContext = new RouteContext(httpContext)
|
||||
@@ -80,7 +81,7 @@ namespace Umbraco.Web.Website.Routing
|
||||
}
|
||||
|
||||
// now find for the default action since we couldn't find the custom one
|
||||
routeValues[UmbracoRouteValueTransformer.ActionToken] = defaultActionName;
|
||||
routeValues[ActionToken] = defaultActionName;
|
||||
candidates = _actionSelector.SelectCandidates(routeContext)
|
||||
.Cast<ControllerActionDescriptor>()
|
||||
.Where(x => TypeHelper.IsTypeAssignableFrom<T>(x.ControllerTypeInfo))
|
||||
|
||||
@@ -20,6 +20,7 @@ using Umbraco.Web.Common.Routing;
|
||||
using Umbraco.Web.Common.Security;
|
||||
using Umbraco.Web.Routing;
|
||||
using Umbraco.Web.Website.Controllers;
|
||||
using static Umbraco.Core.Constants.Web.Routing;
|
||||
using RouteDirection = Umbraco.Web.Routing.RouteDirection;
|
||||
|
||||
namespace Umbraco.Web.Website.Routing
|
||||
@@ -47,9 +48,6 @@ namespace Umbraco.Web.Website.Routing
|
||||
private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||
private readonly IControllerActionSearcher _controllerActionSearcher;
|
||||
|
||||
internal const string ControllerToken = "controller";
|
||||
internal const string ActionToken = "action";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UmbracoRouteValueTransformer"/> class.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user