public void Is_Reserved_By_Route(string url, bool isReserved) { var globalSettings = new GlobalSettings { ReservedPaths = string.Empty, ReservedUrls = string.Empty }; var routingSettings = new WebRoutingSettings { TryMatchingEndpointsForAllPages = true }; RouteEndpoint endpoint1 = CreateEndpoint( "Umbraco/RenderMvc/{action?}/{id?}", new { controller = "RenderMvc" }, 0); RouteEndpoint endpoint2 = CreateEndpoint( "api/{controller?}/{id?}", new { action = "Index" }, 1); var endpointDataSource = new DefaultEndpointDataSource(endpoint1, endpoint2); var routableDocFilter = new RoutableDocumentFilter( Options.Create(globalSettings), Options.Create(routingSettings), GetHostingEnvironment(), endpointDataSource); Assert.AreEqual( !isReserved, // not reserved if it's a document request routableDocFilter.IsDocumentRequest(url)); }
public void Is_Reserved_By_Default_Back_Office_Route(string url, bool isReserved) { var globalSettings = new GlobalSettings { ReservedPaths = string.Empty, ReservedUrls = string.Empty }; var routingSettings = new WebRoutingSettings { TryMatchingEndpointsForAllPages = true }; var endpoint1 = CreateEndpoint( "umbraco/{action?}/{id?}", new { controller = "BackOffice" }); var endpointDataSource = new DefaultEndpointDataSource(endpoint1); var routableDocFilter = new RoutableDocumentFilter( new TestOptionsSnapshot <GlobalSettings>(globalSettings), Options.Create(routingSettings), GetHostingEnvironment(), endpointDataSource); Assert.AreEqual( !isReserved, // not reserved if it's a document request routableDocFilter.IsDocumentRequest(url)); }
public void Is_Not_Reserved_Path_Or_Url(string url) { var routableDocFilter = new RoutableDocumentFilter( GetGlobalSettings(), GetWebRoutingSettings(), GetHostingEnvironment(), new DefaultEndpointDataSource()); // Will be true if it's not reserved Assert.IsTrue(routableDocFilter.IsDocumentRequest(url)); }