public void Is_Reserved_By_Route(string url, bool shouldMatch) { //reset the app config, we only want to test routes not the hard coded paths var globalSettingsMock = Mock.Get(Factory.GetInstance <IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container globalSettingsMock.Setup(x => x.ReservedPaths).Returns(""); globalSettingsMock.Setup(x => x.ReservedUrls).Returns(""); var routableDocFilter = new RoutableDocumentFilter(globalSettingsMock.Object); var routes = new RouteCollection(); routes.MapRoute( "Umbraco_default", "Umbraco/RenderMvc/{action}/{id}", new { controller = "RenderMvc", action = "Index", id = UrlParameter.Optional }); routes.MapRoute( "WebAPI", "api/{controller}/{id}", new { controller = "WebApiTestController", action = "Index", id = UrlParameter.Optional }); var context = new FakeHttpContextFactory(url); Assert.AreEqual( shouldMatch, routableDocFilter.IsReservedPathOrUrl(url, context.HttpContext, routes)); }
public void Is_Not_Reserved_Path_Or_Url(string url) { var globalSettings = TestObjects.GetGlobalSettings(); var routableDocFilter = new RoutableDocumentFilter(globalSettings); Assert.IsFalse(routableDocFilter.IsReservedPathOrUrl(url)); }