public void TestFutureFields() { var validator = new ValidationGroups(); var sampleRq = new EmployeeBuilder().JohnDoe().DateInFuture().BuildAddRequest(); var errors = validator.Validate(sampleRq, sampleRq.GetType()); Assert.IsTrue(errors.Count() == 1); }
public void TestSuccess() { var validator = new ValidationGroups(); var sampleRq = new EmployeeBuilder().JohnDoe().BuildAddRequest(); var errors = validator.Validate(sampleRq, sampleRq.GetType()); Assert.IsTrue(!errors.Any()); }
public void ValidateObjectByType(object value, Type objType) { var validator = new ValidationGroups(); var errors = validator.Validate(value, objType); if (errors.Any()) { throw new ValidationException(errors); } }