diff --git a/src/Validations/ValidatorResult.cs b/src/Validations/ValidatorResult.cs index e25abbc..df2ffe3 100644 --- a/src/Validations/ValidatorResult.cs +++ b/src/Validations/ValidatorResult.cs @@ -150,5 +150,35 @@ private void AddInfo(ValidationInfo info) _infos.Add(info); _items.Add(info); } - + + + public override string ToString() + { + var sb = new StringBuilder(); + if (HasError) + { + sb.AppendLine("[Errors]:"); + foreach (var err in _errors) + sb.AppendLine(err.ToString()); + sb.AppendLine(""); + } + + if (HasWarning) + { + sb.AppendLine("[Warnings]:"); + foreach (var w in _warnings) + sb.AppendLine(w.ToString()); + sb.AppendLine(""); + } + + if (_infos.Any()) + { + sb.AppendLine("[Info]:"); + foreach (var i in _infos) + sb.AppendLine(i.ToString()); + sb.AppendLine(""); + } + + return sb.ToString(); + } } \ No newline at end of file