Esempio n. 1
0
            public void HomeController_in_area_Admin_AllowControllerlessViewFolder()
            {
                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();

                dpp.AllowControllerlessViewFolder = true;
                var paths = dpp.GetViewFolders(controllerContext);

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

                Assert.Equal(expected, paths.ToArray());
            }
Esempio n. 2
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.GetViewFolders(controllerContext);

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

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