public void TestWithPositiveSalary() { var errorMessage = string.Empty; bool result = SalaryValidator.Validate(2000, out errorMessage); Assert.IsTrue(result); Assert.IsEmpty(errorMessage); }
public void TestWithNegativeSalary() { var errorMessage = string.Empty; bool result = SalaryValidator.Validate(-1000, out errorMessage); Assert.IsFalse(result); Assert.IsNotNull(errorMessage); Assert.IsNotEmpty(errorMessage); }
protected override IEnumerable <ValidationError> Validation() { var result = Enumerable.Empty <ValidationError>(); var validationErrors = SalaryValidator.Validate(this); if (!validationErrors.IsNullOrEmpty()) { result = result.Concat(validationErrors); } if (!secondPhaseErrors.IsNullOrEmpty()) { result = result.Concat(secondPhaseErrors); } return(result); }