-Fixed unit test failing because of timezones

-Added IsValid overload that returns a list of error messages
This commit is contained in:
JamesNK
2012-02-10 23:49:46 +00:00
parent 68a200127a
commit 2dd26baa77
4 changed files with 31 additions and 4 deletions
+19
View File
@@ -52,6 +52,25 @@ namespace Newtonsoft.Json.Schema
return valid;
}
/// <summary>
/// Determines whether the <see cref="JToken"/> is valid.
/// </summary>
/// <param name="source">The source <see cref="JToken"/> to test.</param>
/// <param name="schema">The schema to test with.</param>
/// <param name="errorMessages">When this method returns, contains any error messages generated while validating. </param>
/// <returns>
/// <c>true</c> if the specified <see cref="JToken"/> is valid; otherwise, <c>false</c>.
/// </returns>
public static bool IsValid(this JToken source, JsonSchema schema, out IList<string> errorMessages)
{
IList<string> errors = new List<string>();
source.Validate(schema, (sender, args) => errors.Add(args.Message));
errorMessages = errors;
return (errorMessages.Count == 0);
}
/// <summary>
/// Validates the specified <see cref="JToken"/>.
/// </summary>