/// <summary>
/// Verifies Json literal content
/// </summary>
/// <param name="content">the Json literal to be verified</param>
/// <param name="result">output paramter of test result</param>
/// <returns>true if verification passes; false otherwiser</returns>
public bool Verify(string content, out TestResult result)
{
using (var stringReader = new StringReader(content))
{
using (JsonTextReader rdr = new JsonTextReader(stringReader))
{
using (JsonValidatingReader vr = new JsonValidatingReader(rdr))
{
vr.Schema = this.schema;
try
{
while (vr.Read())
{
// Ignore
}
result = new TestResult();
return true;
}
catch (JsonSchemaException jex)
{
result = new TestResult() { LineNumberInError = jex.LineNumber, ErrorDetail = jex.Message };
return false;
}
}
}
}
}