Ejemplo n.º 1
0
        public async Task ValidateAsync_ShouldValidate_WhenCalled()
        {
            var rule    = new ActionAsyncValidationRule <string>(arg => { return(Task.FromResult(true)); }, "You have entered an invalid email");
            var isValid = await rule.ValidateAsync("hello");

            Assert.True(isValid);
        }
Ejemplo n.º 2
0
        public void Validate_ShouldThrowException_WhenCalled()
        {
            var rule = new ActionAsyncValidationRule <string>(arg => { return(Task.FromResult(true)); }, "You have entered an invalid email");

            Assert.Throws <InvalidOperationException>(() => rule.Validate(String.Empty));
        }