public void ShouldReturnEmptyStringIfValueIsNull() { ErrorConverter converter = new ErrorConverter(); object errors = null; object result = converter.Convert(errors, null, null, null); Assert.AreEqual(string.Empty, result); }
public void ShouldReturnEmptyStringIfCollectionIsEmpty() { ErrorConverter converter = new ErrorConverter(); List<ValidationError> errors = new List<ValidationError>(); object result = converter.Convert(errors.AsReadOnly(), null, null, null); Assert.AreEqual(string.Empty, result); }
public void ShouldReturnEmptyStringIfCollectionIsEmpty() { ErrorConverter converter = new ErrorConverter(); ObservableCollection<ValidationError> value = new ObservableCollection<ValidationError>(); object result = converter.Convert(value, null, null, null); Assert.AreEqual(string.Empty, result); }
public void ShouldReturnTheInnerExceptionMessageOfATargetInvocationException() { ErrorConverter converter = new ErrorConverter(); List<ValidationError> errors = new List<ValidationError>(); ValidationError error = new ValidationError(new ExceptionValidationRule(), new object()); error.Exception = new TargetInvocationException(null, new Exception("TestError")); errors.Add(error); object result = converter.Convert(errors.AsReadOnly(), null, null, null); Assert.AreEqual("TestError", result); }
public void ShouldReturnTheErrorContentOfTheFirstItemInTheCollection() { ErrorConverter converter = new ErrorConverter(); List<ValidationError> errors = new List<ValidationError>(); ValidationError error = new ValidationError(new ExceptionValidationRule(), new object()); error.ErrorContent = "TestError"; errors.Add(error); object result = converter.Convert(errors.AsReadOnly(), null, null, null); Assert.AreEqual("TestError", result); }