Fixes unit tests for Umbraco_Route_User_Defined_Controller_Action

This commit is contained in:
Shannon Deminick
2013-01-30 05:37:32 +06:00
parent d0ace55d03
commit a734a0cff7
2 changed files with 6 additions and 3 deletions

View File

@@ -64,7 +64,8 @@ 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("HomePage")]
[TestCase("homePage")]
@@ -84,7 +85,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;
}