コード例 #1
0
        public void Should_be_valid_when_value_is_greater_using_instance_property()
        {
            var validator = new GreaterOrEqualToValidator<Person, int>(p => p.Age);

            var person = new Person {Age = 18};
            Assert.That(validator.Validate(person, 21), Is.True);
        }
コード例 #2
0
        public void Has_default_negated_message()
        {
            var validator = new GreaterOrEqualToValidator<Person, int>(10);

            var message = validator.DefaultNegatedErrorMessage;
            Console.WriteLine(message);
            Assert.That(message, Is.Not.Null & Is.Not.Empty);
        }
コード例 #3
0
        public void Has_default_negated_message()
        {
            var validator = new GreaterOrEqualToValidator <Person, int>(10);

            var message = validator.DefaultNegatedErrorMessage;

            Console.WriteLine(message);
            Assert.That(message, Is.Not.Null & Is.Not.Empty);
        }
コード例 #4
0
        public void Should_be_invalid_when_value_is_lower_using_instance_property()
        {
            var validator = new GreaterOrEqualToValidator <Person, int>(p => p.Age);

            var person = new Person {
                Age = 18
            };

            Assert.That(validator.Validate(person, 16), Is.False);
        }
コード例 #5
0
        public void Should_be_valid_when_value_is_greater()
        {
            var validator = new GreaterOrEqualToValidator<Person, int>(18);

            Assert.That(validator.Validate(null, 21), Is.True);
        }
コード例 #6
0
        public void Should_be_invalid_when_value_is_lower()
        {
            var validator = new GreaterOrEqualToValidator<Person, int>(18);

            Assert.That(validator.Validate(null, 16), Is.False);
        }
コード例 #7
0
        public void Should_be_invalid_when_value_is_lower()
        {
            var validator = new GreaterOrEqualToValidator <Person, int>(18);

            Assert.That(validator.Validate(null, 16), Is.False);
        }
コード例 #8
0
        public void Should_be_valid_when_value_is_equal()
        {
            var validator = new GreaterOrEqualToValidator <Person, int>(18);

            Assert.That(validator.Validate(null, 18), Is.True);
        }