Beispiel #1
0
        public void GetRoutesHierarchyTest()
        {
            RouteInfo info = new RouteInfo {Controller = InfoControllerName};
            var testRoute = new RouteInfo {Controller = TestControllerName};
            var testRouteA = new RouteInfo {Controller = TestAControllerName};
            info.Children.Add(testRoute);
            info.Children.Add(testRouteA);

            var list = testRoute.TreeStructureToList();
            Assert.AreEqual(1, list.Count);
            StringAssert.AreEqualIgnoringCase(list[0].Controller, testRoute.Controller);

            var listA = testRouteA.TreeStructureToList();
            Assert.AreEqual(1, listA.Count);
            StringAssert.AreEqualIgnoringCase(listA[0].Controller, testRouteA.Controller);

            var infoList = info.TreeStructureToList();
            Assert.AreEqual(3, infoList.Count);
        }
 public static void Map(this RouteCollection collection, RouteInfo rootRoute)
 {
     foreach (RouteInfo ri in rootRoute.TreeStructureToList())
         collection.MapPageRoute(ri.GetRouteName(), ri.GetRouteUrl(), string.Empty);
 }