public void RouteCollectionSetup()
        {
            var area = new PrivateAreaRegistration();
            var area4Context = new AreaRegistrationContext(area.AreaName, RouteTable.Routes);
            area.RegisterArea(area4Context);

            RouteConfig.RegisterRoutes(RouteTable.Routes);

            this.routeCollection = RouteTable.Routes;
        }
        internal static RouteData GetPrivateAreaRouteData(string route)
        {
            var routeCollection = new RouteCollection();
            var areaReg = new PrivateAreaRegistration();
            areaReg.RegisterArea(new AreaRegistrationContext(areaReg.AreaName, routeCollection));

            var context = new Mock<HttpContextBase>();
            context.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath).Returns(route);

            // Get the RouteData based on the HttpContext
            var routeData = routeCollection.GetRouteData(context.Object);
            return routeData;
        }
Exemple #3
0
        internal static RouteData GetPrivateAreaRouteData(string route)
        {
            var routeCollection = new RouteCollection();
            var areaReg         = new PrivateAreaRegistration();

            areaReg.RegisterArea(new AreaRegistrationContext(areaReg.AreaName, routeCollection));

            var context = new Mock <HttpContextBase>();

            context.Setup(c => c.Request.AppRelativeCurrentExecutionFilePath).Returns(route);

            // Get the RouteData based on the HttpContext
            var routeData = routeCollection.GetRouteData(context.Object);

            return(routeData);
        }