Ejemplo n.º 1
0
        public void Ctor_WithDirectoryNameArg_AppendsPathInfoCatchAll()
        {
            //arrange, act
            var route = new DirectoryRoute("dir", new Mock<IServiceLocator>().Object);
            ;

            //assert
            Assert.AreEqual("dir/{*pathInfo}", route.Url);
        }
Ejemplo n.º 2
0
        public void Ctor_WithDirectoryNameArg_SetsDirectoryName()
        {
            //arrange, act
            var route = new DirectoryRoute("dir", new Mock<IServiceLocator>().Object);
            ;

            //assert
            Assert.AreEqual("dir", route.DirectoryName);
        }
Ejemplo n.º 3
0
        public void Ctor_WithDirectoryNameArg_SetsDirectoryName()
        {
            //arrange, act
            var route = new DirectoryRoute("dir", new Mock<IDependencyResolver>().Object);
            ;

            //assert
            Assert.AreEqual("dir", route.DirectoryName);
        }
Ejemplo n.º 4
0
        public void GetRouteData_MatchingTheImplicitSubfolderRoute_ReturnsParentDirectoryRoute()
        {
            //arrange
            var route = new DirectoryRoute("dir", new Mock<IServiceLocator>().Object);
            ;
            var httpContext = new Mock<HttpContextBase>();
            httpContext.FakeRequest("~/subfolder/dir/foo.aspx");
            var blogRequest = new BlogRequest("localhost", "subfolder", new Uri("http://localhost"), false);

            //act
            RouteData routeData = route.GetRouteData(httpContext.Object, blogRequest);

            //assert
            Assert.AreEqual(route, routeData.Route);
        }
Ejemplo n.º 5
0
        public void GetVirtualPath_WithoutSubolder_ReturnsUrlWithoutSubfolder()
        {
            //arrange
            var route = new DirectoryRoute("admin", new Mock<IServiceLocator>().Object);
            var httpContext = new Mock<HttpContextBase>();
            httpContext.FakeRequest("~/admin/posts/foo.aspx");
            var blogRequest = new BlogRequest("localhost", null, new Uri("http://localhost"), true);
            var routeData = new RouteData();
            var requestContext = new RequestContext(httpContext.Object, routeData);

            //act
            VirtualPathData virtualPath = route.GetVirtualPath(requestContext
                                                               ,
                                                               new RouteValueDictionary(
                                                                   new {pathInfo = "posts/foo.aspx"}));

            //assert
            Assert.IsNotNull(virtualPath);
            Assert.AreEqual("admin/posts/foo.aspx", virtualPath.VirtualPath);
        }