Fixes unit tests and logic for Umbraco_Route_User_Defined_Controller_Action

This commit is contained in:
Shannon Deminick
2013-01-30 05:55:40 +06:00
parent 350bea7798
commit 30fe0ecaf4
2 changed files with 7 additions and 2 deletions

View File

@@ -69,6 +69,9 @@ namespace Umbraco.Tests.Routing
//test all template name styles to match the ActionName
[TestCase("home-page")]
[TestCase("home-\\234^^*32page")]
[TestCase("home-page")]
[TestCase("home-page")]
[TestCase("Home-Page")]
[TestCase("HomePage")]
[TestCase("homePage")]
@@ -88,7 +91,9 @@ namespace Umbraco.Tests.Routing
handler.GetHandlerForRoute(routingContext.UmbracoContext.HttpContext.Request.RequestContext, docRequest);
Assert.AreEqual("CustomDocument", routeData.Values["controller"].ToString());
Assert.AreEqual("HomePage", routeData.Values["action"].ToString());
Assert.AreEqual(
global::umbraco.cms.helpers.Casing.SafeAlias(templateName),
routeData.Values["action"].ToString());
}

View File

@@ -274,7 +274,7 @@ namespace Umbraco.Web.Mvc
//the template Alias should always be already saved with a safe name.
//if there are hyphens in the name and there is a hijacked route, then the Action will need to be attributed
// with the action name attribute.
var templateName = publishedContentRequest.Template.Alias.Split('.')[0];
var templateName = global::umbraco.cms.helpers.Casing.SafeAlias(publishedContentRequest.Template.Alias.Split('.')[0]);
def.ActionName = templateName;
}