Exemplo n.º 1
0
 public ValidationResult FirstOrDefaultForObject(Func <ValidationResult, bool> predicate)
 {
     if (predicate(this))
     {
         return(this);
     }
     else
     {
         return(NestedValidationResults.Select(nestedValidationResult => nestedValidationResult.FirstOrDefaultForObject(predicate)).FirstOrDefault(foundNode => foundNode != null));
     }
 }
Exemplo n.º 2
0
 public IEnumerable <ValidationResult> All()
 {
     return((new[] { this }).Union(NestedValidationResults.SelectMany(x => x.All())));
 }
Exemplo n.º 3
0
 internal string PrintNode(string prefix)
 {
     return(prefix + Message + "\r\n" +
            NestedValidationResults.Select(vr => vr.PrintNode(prefix + "\t")).DefaultIfEmpty().
            Aggregate((a, b) => a + b));
 }