public void StringRouteConstraintKeyNotFoundWithRouteDirectionIncomingRequestTest()
        {
            // Arrange
            var constraint = new StringRouteConstraint("admin");

            // Act
            var values = new RouteValueDictionary(new { controller = "admin" });

            var match = constraint.Match(
                new DefaultProtoContext(),
                route: new Mock <IRouter>().Object,
                routeKey: "action",
                values: values,
                routeDirection: RouteDirection.IncomingRequest);

            // Assert
            Assert.False(match);
        }
        public void StringRouteConstraintEscapingCaseSensitiveAndRouteNullTest(string routeValue, string constraintValue, bool expected)
        {
            // Arrange
            var constraint = new StringRouteConstraint(constraintValue);

            // Act
            var values = new RouteValueDictionary(new { controller = routeValue });

            var match = constraint.Match(
                new DefaultProtoContext(),
                route: new Mock <IRouter>().Object,
                routeKey: "controller",
                values: values,
                routeDirection: RouteDirection.IncomingRequest);

            // Assert
            Assert.Equal(expected, match);
        }
        public void StringRouteConstraintSimpleFalseWithRouteDirectionUrlGenerationTest()
        {
            // Arrange
            var constraint = new StringRouteConstraint("admin");

            // Act
            var values = new RouteValueDictionary(new { controller = "home" });

            var match = constraint.Match(
                new DefaultProtoContext(),
                route: new Mock <IRouter>().Object,
                routeKey: "controller",
                values: values,
                routeDirection: RouteDirection.UrlGeneration);

            // Assert
            Assert.False(match);
        }
        public void StringRouteConstraintSimpleTrueWithRouteDirectionIncomingRequestTest()
        {
            // Arrange
            var constraint = new StringRouteConstraint("home");

            // Act
            var values = new RouteValueDictionary(new { controller = "home" });

            var match = constraint.Match(
                new DefaultProtoContext(),
                route: new Mock <IRouter>().Object,
                routeKey: "controller",
                values: values,
                routeDirection: RouteDirection.IncomingRequest);

            // Assert
            Assert.True(match);
        }