コード例 #1
0
        private void TestRouteFail(string url)
        {
            // Arrange
            RouteCollection routes = new RouteCollection();
            RouteConstraintFactoryMvcApplication.IRouteRegistry registerer =
                new MyRouteRegistry(new FakeRouteConstraintFactory());
            registerer.RegisterRoutes(routes);

            // Act - process the route
            RouteData result = routes.GetRouteData(CreateHttpContext(url));

            // Assert
            Assert.IsTrue(result == null || result.Route == null);
        }
コード例 #2
0
        private void TestRouteMatch(
            string url, string controller, string action, 
            object routeProperties = null, string httpMethod = "GET")
        {
            // Arrange
            RouteCollection routes = new RouteCollection();

            RouteConstraintFactoryMvcApplication.IRouteRegistry registerer =
                new MyRouteRegistry(new FakeRouteConstraintFactory());
            registerer.RegisterRoutes(routes);

            // Act - process the route
            RouteData result = routes.GetRouteData(CreateHttpContext(url, httpMethod));

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(TestIncomingRouteResult(result, controller, action, routeProperties));
        }