public void IsValidWhenErrorMessageIsEmpty()
        {
            ValidationResult result = new ValidationResult();
            Assert.IsTrue(result.IsValid);

            result = new ValidationResult(string.Empty);
            Assert.IsTrue(result.IsValid);

            result = new ValidationResult(null);
            Assert.IsTrue(result.IsValid);
        }
        public void SetUp()
        {
            uiElmentMock = new Mock<IUIElement>();
            validationContainerMock = new Mock<IValidationContainer>();
            uiElmentMock.Setup(d => d.SetValue(ValidationContainer.ValidationResultProperty, It.IsAny<ValidationResult>()))
                .Callback((DependencyProperty property,object result) => validationResult = (ValidationResult) result);

            validationSource1 = new StubValidationSource();
            validationSource1.ValidationFuncs.Add(fieldName, () =>  errorMessage1) ;
            validationSource2 = new StubValidationSource();
            validationSource2.ValidationFuncs.Add(fieldName, () => errorMessage2);
        }
Пример #3
0
 public bool Equals(ValidationResult other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.errorMessage, errorMessage);
 }
 public void IsNotValidWhenErrorMessageIsNotEmpty()
 {
     ValidationResult result = new ValidationResult("something");
     Assert.IsFalse(result.IsValid);
 }