public void When_the_text_is_larger_than_the_range_then_the_validator_should_fail_for_dates() { DateTime value = new DateTime(2010, 1, 1); var validator = new ExclusiveBetweenValidator(fromDate, toDate); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_value_is_smaller_than_the_range_then_the_validator_should_fail_for_strings() { string value = "aaa"; var validator = new ExclusiveBetweenValidator("bbb", "zz"); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_text_is_larger_than_the_range_then_the_validator_should_fail() { int value = 11; var validator = new ExclusiveBetweenValidator(1, 10); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_value_is_exactly_the_size_of_the_upper_bound_then_the_validator_should_fail_for_strings() { string value = "aa"; var validator = new ExclusiveBetweenValidator("aa", "zz"); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_value_is_smaller_than_the_range_then_the_validator_should_fail_for_doubles() { double value = 0.9; var validator = new ExclusiveBetweenValidator(1.0, 10.0); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_value_is_exactly_the_size_of_the_upper_bound_then_the_validator_should_fail_for_dates() { DateTime value = new DateTime(2009, 12, 31); var validator = new ExclusiveBetweenValidator(fromDate, toDate); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_value_is_exactly_the_size_of_the_upper_bound_then_the_validator_should_fail_for_doubles() { double value = 10.0; var validator = new ExclusiveBetweenValidator(1.0, 10.0); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_value_is_between_the_range_specified_then_the_validator_should_pass_for_strings() { string value = "bbb"; var validator = new ExclusiveBetweenValidator("aa", "zz"); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeTrue(); }
public void When_the_value_is_exactly_the_size_of_the_lower_bound_then_the_validator_should_fail() { int value = 1; var validator = new ExclusiveBetweenValidator(1, 10); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeFalse(); }
public void When_the_value_is_between_the_range_specified_then_the_validator_should_pass_for_doubles() { double value = 5.0; var validator = new ExclusiveBetweenValidator(1.0, 10.0); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeTrue(); }
public void When_the_value_is_between_the_range_specified_then_the_validator_should_pass_for_dates() { DateTime value = new DateTime(2009, 9, 9); var validator = new ExclusiveBetweenValidator(fromDate, toDate); var result = validator.Validate(new PropertyValidatorContext(null, new object(), x => value)); result.IsValid().ShouldBeTrue(); }
public void When_the_validator_fails_the_error_message_should_be_set_for_strings() { string value = "aaa"; var validator = new ExclusiveBetweenValidator("bbb", "zzz"); var result = validator.Validate(new PropertyValidatorContext("Value", null, x => value)); result.Single().ErrorMessage.ShouldEqual("'Value' must be between bbb and zzz (exclusive). You entered aaa."); }
public void When_the_validator_fails_the_error_message_should_be_set_for_doubles() { var validator = new ExclusiveBetweenValidator(1.2, 10.9); var result = validator.Validate(new PropertyValidatorContext("Value", null, x => 0.0)); result.Single().ErrorMessage.ShouldEqual("'Value' must be between 1.2 and 10.9 (exclusive). You entered 0."); }
public void When_the_validator_fails_the_error_message_should_be_set_for_dates() { DateTime value = new DateTime(2008, 1, 1); var validator = new ExclusiveBetweenValidator(fromDate, toDate); var result = validator.Validate(new PropertyValidatorContext("Value", null, x => value)); result.Single().ErrorMessage.ShouldEqual("'Value' must be between 1/1/2009 12:00:00 AM and 12/31/2009 12:00:00 AM (exclusive). You entered 1/1/2008 12:00:00 AM."); }