示例#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.GetPartialsFolders(controllerContext);

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

                Assert.Equal(expected, paths.ToArray());
            }
示例#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.GetPartialsFolders(controllerContext);

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

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