Esempio n. 1
0
        public async Task ShouldHaveValidationError_model_async()
        {
            var validator = new InlineValidator <Person>();

            validator.RuleFor(x => x.Surname).MustAsync((x, ct) => Task.FromResult(false));
            await validator.ShouldHaveValidationErrorForAsync(x => x.Surname, new Person());
        }
Esempio n. 2
0
        public async Task ShouldHaveValidationError_model_async_throws()
        {
            var validator = new InlineValidator <Person>();

            validator.RuleFor(x => x.Surname).MustAsync((x, ct) => Task.FromResult(true));
            await Assert.ThrowsAsync <ValidationTestException>(async() => {
                await validator.ShouldHaveValidationErrorForAsync(x => x.Surname, new Person());
            });
        }