public void AsyncMultipleWrappedValidators()
        {
            var validator1 = new AsyncWrapTextValidator(PredefinedTextValidation.IsEmailAddress.GetValidator());
            var validator2 = new AsyncWrapTextValidator(PredefinedTextValidation.IsLettersOnly.GetValidator());

            var wrapper = validator1.WrapAsync(validator2);

            Assert.That(wrapper, Is.InstanceOf <AsyncMultipleTextValidators>());

            var innerValidators = ((AsyncMultipleTextValidators)wrapper).GetWrappedAsyncValidators().ToList();

            Assert.That(innerValidators[0], Is.InstanceOf <AsyncWrapTextValidator>());
            Assert.That(innerValidators[1], Is.InstanceOf <AsyncWrapTextValidator>());

            Assert.That(((AsyncWrapTextValidator)innerValidators[0]).GetWrappedValidators().First(), Is.InstanceOf <RegexTextValidator>());
            Assert.That(((AsyncWrapTextValidator)innerValidators[1]).GetWrappedValidators().First(), Is.InstanceOf <FunctionTextValidator>());
        }
Example #2
0
        public void Setup()
        {
            _synchronousTextValidator = new Mock <ITextValidator>();

            _asyncWrapTextValidator = new AsyncWrapTextValidator(_synchronousTextValidator.Object);
        }