public void Should_not_match_when_parameter_value_is_zero()
        {
            var constraint = new PositiveIntegerConstraint();

            var matched = constraint.Match(new Mock<HttpContextBase>().Object, new Route("{controller}/{action}", new Mock<IRouteHandler>().Object), "id", new RouteValueDictionary { { "id", 0 } }, RouteDirection.IncomingRequest);

            Assert.False(matched);
        }
        public void Should_match_when_parameter_is_optional()
        {
            var constraint = new PositiveIntegerConstraint(true);

            var matched = constraint.Match(new Mock<HttpContextBase>().Object, new Route("{controller}/{action}", new Mock<IRouteHandler>().Object), "id", new RouteValueDictionary(), RouteDirection.IncomingRequest);

            Assert.True(matched);
        }
        public void Should_match_when_parameter_is_optional()
        {
            var constraint = new PositiveIntegerConstraint(true);

            var matched = constraint.Match(new Mock <HttpContextBase>().Object, new Route("{controller}/{action}", new Mock <IRouteHandler>().Object), "id", new RouteValueDictionary(), RouteDirection.IncomingRequest);

            Assert.True(matched);
        }
        public void Should_not_match_when_parameter_value_is_negative()
        {
            var constraint = new PositiveIntegerConstraint();

            var matched = constraint.Match(new Mock <HttpContextBase>().Object, new Route("{controller}/{action}", new Mock <IRouteHandler>().Object), "id", new RouteValueDictionary {
                { "id", -7 }
            }, RouteDirection.IncomingRequest);

            Assert.False(matched);
        }