Beispiel #1
0
        public void ValidatorWillSetValidatorToThis()
        {
            Validator validator = new MockValidator(true, "template");

            ValidationResults validationResults = new ValidationResults();

            validator.DoValidate(this, this, "key", validationResults);

            Assert.IsFalse(validationResults.IsValid);
            IDictionary <string, ValidationResult> resultsMapping = ValidationTestHelper.GetResultsMapping(validationResults);

            Assert.AreSame(validator, resultsMapping["template"].Validator);
        }
Beispiel #2
0
        public void ValidatorWillSetKeyIfProvided()
        {
            Validator validator = new MockValidator(true, "template");

            ValidationResults validationResults = new ValidationResults();

            validator.DoValidate(this, this, "key", validationResults);

            Assert.IsFalse(validationResults.IsValid);
            IDictionary <string, ValidationResult> resultsMapping = ValidationTestHelper.GetResultsMapping(validationResults);

            Assert.AreEqual("key", resultsMapping["template"].Key);
        }
        public void ValidatorWillSetValidatorToThis()
        {
            Validator validator = new MockValidator(true, "template");

            ValidationResults validationResults = new ValidationResults();
            validator.DoValidate(this, this, "key", validationResults);

            Assert.IsFalse(validationResults.IsValid);
            IDictionary<string, ValidationResult> resultsMapping = ValidationTestHelper.GetResultsMapping(validationResults);
            Assert.AreSame(validator, resultsMapping["template"].Validator);
        }
        public void ValidatorWillSetKeyIfProvided()
        {
            Validator validator = new MockValidator(true, "template");

            ValidationResults validationResults = new ValidationResults();
            validator.DoValidate(this, this, "key", validationResults);

            Assert.IsFalse(validationResults.IsValid);
            IDictionary<string, ValidationResult> resultsMapping = ValidationTestHelper.GetResultsMapping(validationResults);
            Assert.AreEqual("key", resultsMapping["template"].Key);
        }