コード例 #1
0
        public void ShouldNotBePossibleEvaluateRuleWithBetweenConstraintWhenPropertyHasOtherType()
        {
            var data       = ObjectHelper.ToDictionary(new { Age = "Older" });
            var constraint = new BetweenConstraint("Age", 12, 18);

            Assert.False(constraint.Evaluate(data));
        }
コード例 #2
0
        public void ShouldNotBePossibleEvaluateRuleWithBetweenConstraintAndPropertyMissing()
        {
            var data       = ObjectHelper.ToDictionary(new { });
            var constraint = new BetweenConstraint("Age", 12, 18);

            Assert.False(constraint.Evaluate(data));
        }
コード例 #3
0
        public void ShouldNotBePossibleEvaluateRuleWithBetweenConstraintWhenPropertyIsNull()
        {
            var data       = ObjectHelper.ToDictionary(new { Age = (int?)null });
            var constraint = new BetweenConstraint("Age", 12, 18);

            Assert.False(constraint.Evaluate(data));
        }
コード例 #4
0
        public void ShouldNotBePossibleEvaluateRuleWithBetweenConstraintAndValueOutOfRange()
        {
            var data = ObjectHelper.ToDictionary(new
            {
                Age = 19
            });

            var constraint = new BetweenConstraint("Age", 12, 18);

            Assert.False(constraint.Evaluate(data));
        }