public void TestRequiredValidatorShouldBeFailed()
 {
     var modelToValidate = new FakeModel();
     var validator = CreateRequiredFactory().ResolveModel<FakeModel>();
     var result = validator.Validate(modelToValidate);
     Assert.IsNotNull(result);
     Assert.IsFalse(result.IsValid());
     var failedValidator = result.FailedValidators.SingleOrDefault(x => x.Key.Equals(RequiredKey));
     Assert.IsNotNull(failedValidator);
 }
        public void TestCollectionRequiredValidatorShouldBeFailedForEmptyCollection()
        {
            var modelToValidate = new FakeModel();
            modelToValidate.RequiredCollection = new List<string>();
            var validator = CreateRequiredCollectionFactory().ResolveModel<FakeModel>();
            var result = validator.Validate(modelToValidate);

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsValid());
            var failedValidator = result.FailedValidators.SingleOrDefault(x => x.Key.Equals(CollectionRequiredKey));
            Assert.IsNotNull(failedValidator);
        }
        public void TestDeniedValueValidatorShouldBeFailedForDeniedValue()
        {
            var modelToValidate = new FakeModel();
            const int DeniedValue = 1;
            modelToValidate.DeniedValueProperty = DeniedValue;
            var validator = CreateDeniedValuesFactory(DeniedValue).ResolveModel<FakeModel>();
            var result = validator.Validate(modelToValidate);

            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsValid());
            var failedValidator = result.FailedValidators.SingleOrDefault(x => x.Key.Equals(DeniedValuesKey));
            Assert.IsNotNull(failedValidator);
        }