public void FrontEndRouting_Umbraco_Pages(string routeUrl, string matchUrl) { //set the fake render model factory to match "/" for the specified content item RenderModelFactory.AddMatchingUrlForContent(matchUrl, new Content(new HiveId(Guid.NewGuid()), new List <TypedAttribute>())); RouteTable.Routes.GetDataForRoute(routeUrl).ShouldMapTo <UmbracoController>(x => x.Index((IUmbracoRenderModel)null)); }
public void FrontEndRouting_Umbraco_Route_User_Defined_Controller_Action() { var http = new FakeHttpContextFactory("~/home-page"); var content = new Content(new HiveId(Guid.NewGuid()), new List <TypedAttribute>()); content.CurrentTemplate = new Template(new HiveId(new Uri("storage://templates"), "", new HiveIdValue("home-page.cshtml"))); content.ContentType = new EntitySchema("customUmbraco"); RenderModelFactory.AddMatchingUrlForContent("/home-page", content); var data = RouteTable.Routes.GetDataForRoute(http.HttpContext); Assert.AreEqual(typeof(RenderRouteHandler), data.RouteHandler.GetType()); var handler = (RenderRouteHandler)data.RouteHandler; handler.GetHandlerForRoute(http.RequestContext, RenderModelFactory.Create(http.HttpContext, http.HttpContext.Request.RawUrl)); Assert.AreEqual("CustomUmbraco", data.Values["controller"].ToString()); Assert.AreEqual("HomePage", data.Values["action"].ToString()); }