示例#1
0
        public void RouteWithTooManySegments()
        {
            // Arrange
            var context = new StubHttpContextForRouting(requestUrl: "~/a/b/c/d");
            // Act
            RouteData routeData = _routes.GetRouteData(context);

            // Assert
            Assert.IsNull(routeData);
        }
示例#2
0
        public void RouteWithController_WithAction_NoId()
        {
            // Arrange
            var context = new StubHttpContextForRouting(requestUrl: "~/en/games/action2");

            // Act
            RouteData routeData = _routes.GetRouteData(context);

            // Assert
            Assert.IsNotNull(routeData);
            Assert.AreEqual("Games", routeData.Values["controller"]);
            Assert.AreEqual("action2", routeData.Values["action"]);
        }
示例#3
0
        public void DefaultRoute()
        {
            // Arrange
            var context = new StubHttpContextForRouting("~/");

            // Act
            RouteData routeData = _routes.GetRouteData(context);

            // Assert
            Assert.IsNotNull(routeData);
            Assert.AreEqual("Games", routeData.Values["controller"]);
            Assert.AreEqual("Index", routeData.Values["action"]);
        }
示例#4
0
        public void RouteForDetails()
        {
            // Arrange
            var context = new StubHttpContextForRouting(requestUrl: "~/en/game/Gta6_ThirdEdition/Details");

            // Act
            RouteData routeData = _routes.GetRouteData(context);

            // Assert
            Assert.IsNotNull(routeData);
            Assert.AreEqual("Comments", routeData.Values["controller"]);
            Assert.AreEqual("Details", routeData.Values["action"]);
            Assert.AreEqual("Gta6_ThirdEdition", routeData.Values["key"]);
        }