Beispiel #1
0
        public void To_and_from_properties_should_be_set_for_strings()
        {
            var validator = RangeValidatorFactory.CreateInclusiveBetween <Person, string>("a", "c");

            validator.From.ShouldEqual("a");
            validator.To.ShouldEqual("c");
        }
Beispiel #2
0
        public void To_and_from_properties_should_be_set_for_dates()
        {
            var validator = RangeValidatorFactory.CreateExclusiveBetween <Person, DateTime>(_fromDate, _toDate);

            validator.From.ShouldEqual(_fromDate);
            validator.To.ShouldEqual(_toDate);
        }
Beispiel #3
0
        public void To_and_from_properties_should_be_set()
        {
            var validator = RangeValidatorFactory.CreateInclusiveBetween <Person, int>(1, 10);

            validator.From.ShouldEqual(1);
            validator.To.ShouldEqual(10);
        }
Beispiel #4
0
 public void When_the_to_is_smaller_than_the_from_then_the_validator_should_throw_for_strings()
 {
     typeof(ArgumentOutOfRangeException).ShouldBeThrownBy(() => RangeValidatorFactory.CreateInclusiveBetween <Person, string>("ccc", "aaa"));
 }
Beispiel #5
0
 public void When_the_to_is_smaller_than_the_from_then_the_validator_should_throw_for_strings()
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => RangeValidatorFactory.CreateExclusiveBetween <Person, string>("ccc", "aaa"));
 }