public async Task Does_not_throws_exception_when_preValidate_ends_with_continueValidation_false_async() { var validator = new TestValidatorWithPreValidate { PreValidateMethod = (context, result) => false }; await validator.ValidateAndThrowAsync(new Person()); }
public void Does_not_throws_exception_when_preValidate_ends_with_continueValidation_false() { var validator = new TestValidatorWithPreValidate { PreValidateMethod = (context, result) => false }; validator.ValidateAndThrow(new Person()); }
public void Throws_exception_when_preValidate_fails_and_continueValidation_false() { var validator = new TestValidatorWithPreValidate { PreValidateMethod = (context, result) => { result.Errors.Add(new ValidationFailure("test", "test")); return(false); } }; Assert.Throws <ValidationException>(() => validator.ValidateAndThrow(new Person())); }
public async Task Throws_exception_when_preValidate_fails_and_continueValidation_false_async() { var validator = new TestValidatorWithPreValidate { PreValidateMethod = (context, result) => { result.Errors.Add(new ValidationFailure("test", "test")); return(false); } }; await Assert.ThrowsAsync <ValidationException>(async() => { await validator.ValidateAndThrowAsync(new Person()); }); }
public AbstractValidatorTester() { CultureScope.SetDefaultCulture(); validator = new TestValidator(); testValidatorWithPreValidate = new TestValidatorWithPreValidate(); }