public static ValidationResult FailureResult(string message) { var validationResult = new ValidationResult { Valid = false, }; validationResult.Messages.Add(message); return validationResult; }
public static ValidationResult operator + (ValidationResult vr1, ValidationResult vr2) { var sumOfValidationResults = new ValidationResult() { Valid = vr1.Valid && vr2.Valid }; sumOfValidationResults.Messages.AddRange(vr1.Messages); sumOfValidationResults.Messages.AddRange(vr2.Messages); return sumOfValidationResults; }