Esempio n. 1
0
            public void BlogController()
            {
                var httpContext = new Mock <HttpContextBase>();
                var controller  = new Mock <ControllerBase>();
                var routeData   = new RouteData();

                routeData.Values.Add("controller", "Blog");
                var controllerContext = new ControllerContext(httpContext.Object, routeData, controller.Object);

                var dpp   = new DefaultPathsProvider();
                var paths = dpp.GetLayoutFolders(controllerContext);

                var expected = new string[] {
                    "~/Views/Blog/_Layouts/",
                    "~/Views/_Layouts/"
                };

                Assert.Equal(expected, paths.ToArray());
            }
Esempio n. 2
0
            public void HomeController_in_area_Admin()
            {
                var httpContext = new Mock <HttpContextBase>();
                var controller  = new Mock <ControllerBase>();
                var routeData   = new RouteData();

                routeData.Values.Add("controller", "Home");
                routeData.DataTokens.Add("area", "Admin");
                var controllerContext = new ControllerContext(httpContext.Object, routeData, controller.Object);

                var dpp   = new DefaultPathsProvider();
                var paths = dpp.GetLayoutFolders(controllerContext);

                var expected = new string[] {
                    "~/Areas/Admin/Views/Home/_Layouts/",
                    "~/Areas/Admin/Views/_Layouts/",
                    "~/Views/Home/_Layouts/",
                    "~/Views/_Layouts/"
                };

                Assert.Equal(expected, paths.ToArray());
            }