public void ValidateRegexWithAllowNullSetToFalse() { var obj = new ModelWithOneNullableRegexIntField() { RegexField = null, }; var validation = ModelValidator.ValidateEntity(obj); Assert.IsTrue(validation.HasError); obj = new ModelWithOneNullableRegexIntField() { RegexField = 2, }; validation = ModelValidator.ValidateEntity(obj); Assert.IsFalse(validation.HasError); obj = new ModelWithOneNullableRegexIntField() { RegexField = -2 }; validation = ModelValidator.ValidateEntity(obj); Assert.IsTrue(validation.HasError); }
public void ValidatePositiveIntegerWithNullValue() { var obj = new ModelWithOneNullableRegexIntField() { RegexField = null }; var validation = ModelValidator.ValidateEntity(obj); Assert.IsTrue(validation.HasError); }