public void ThrowsIfCommandIsInvalidButNotRequired() { var testCommand = new InvalidCommand { Invalid = true }; Assert.Throws <ValidationException>(() => commandProcessor.Process(testCommand)); }
public void ThrowsIfCommandIsInvalidButNotRequired() { var testCommand = new InvalidCommand { Invalid = true }; commandProcessor.Process(testCommand); }
public void CanGetValidationResultsForInvalidCommand() { var command = new InvalidCommand(); var results = command.ValidationResults(); Assert.IsNotNull(results); Assert.AreEqual(1, results.Count); var enumerator = results.GetEnumerator(); enumerator.MoveNext(); Assert.AreEqual("The Invalid field is required.", enumerator.Current.ErrorMessage); }
public void CanGetValidationResultsForInvalidCommand() { var command = new InvalidCommand(); var results = command.ValidationResults(); Assert.IsNotNull(results); Assert.AreEqual(2, results.Count); var enumerator = results.GetEnumerator(); enumerator.MoveNext(); //todo: the ErrorMessage maybe different in different culture. //Assert.AreEqual("The Invalid field is required.", enumerator.Current.ErrorMessage); enumerator.MoveNext(); //todo: the ErrorMessage maybe different in different culture. //Assert.AreEqual("The field InvalidInt must be between 100 and 199.", enumerator.Current.ErrorMessage); }
public void IsValidReturnsFalseForInvalidCommand() { var command = new InvalidCommand(); Assert.IsFalse(command.IsValid()); }
public void ThrowsIfCommandIsInvalid() { var testCommand = new InvalidCommand(); commandProcessor.Process(testCommand); }
public void ThrowsIfCommandIsInvalid() { var testCommand = new InvalidCommand(); Assert.Throws <ValidationException>(() => commandProcessor.Process(testCommand)); }