public void RequiredRouteConstraint_Null(RouteDirection direction)
        {
            // Arrange
            var constraint = new RequiredRouteConstraint();

            // Act
            var result = constraint.Match(
                Mock.Of<HttpContext>(),
                Mock.Of<IRouter>(),
                "area",
                new RouteValueDictionary(new { controller = "Home", action = "Index", area = (string)null }),
                direction);

            // Assert
            Assert.False(result);
        }
Exemplo n.º 2
0
        public void RequiredRouteConstraint_EmptyString(RouteDirection direction)
        {
            // Arrange
            var constraint = new RequiredRouteConstraint();

            // Act
            var result = constraint.Match(
                Mock.Of <HttpContext>(),
                Mock.Of <IRouter>(),
                "area",
                new RouteValueDictionary(new { controller = "Home", action = "Index", area = string.Empty }),
                direction);

            // Assert
            Assert.False(result);
        }
        public void RequiredRouteConstraint_WithValue(RouteDirection direction)
        {
            // Arrange
            var constraint = new RequiredRouteConstraint();

            // Act
            var result = constraint.Match(
                new DefaultHttpContext(),
                Mock.Of <IRouter>(),
                "area",
                new RouteValueDictionary(new { controller = "Home", action = "Index", area = "Store" }),
                direction);

            // Assert
            Assert.True(result);
        }
        public void RequiredRouteConstraint_Null(RouteDirection direction)
        {
            // Arrange
            var constraint = new RequiredRouteConstraint();

            // Act
            var result = constraint.Match(
                new DefaultProtoContext(),
                Mock.Of <IRouter>(),
                "area",
                new RouteValueDictionary(new { controller = "Home", action = "Index", area = (string)null }),
                direction);

            // Assert
            Assert.False(result);
        }