public void ExtendedFunctionalityTestPasses(string id, ExtendedFunctionalityTestCase testCase) { JToken result = testCase.run(); if (testCase.error != null) { Assert.True(((string)result["error"]).StartsWith((string)testCase.error), "Resulting error doesn't match expectations."); } else { if (!JsonLdUtils.DeepCompare(result, testCase.output, true)) { #if DEBUG Console.WriteLine(id); Console.WriteLine("Actual:"); Console.Write(JSONUtils.ToPrettyString(result)); Console.WriteLine("--------------------------"); Console.WriteLine("Expected:"); Console.Write(JSONUtils.ToPrettyString(testCase.output)); Console.WriteLine("--------------------------"); #endif Assert.True(false, "Returned JSON doesn't match expectations."); } } }
public void ConformanceTestPasses(string id, string testname, ConformanceCase conformanceCase) { JToken result = conformanceCase.run(); if (conformanceCase.error != null) { Assert.True(((string)result["error"]).StartsWith((string)conformanceCase.error), "Resulting error doesn't match expectations."); } else { if (!JsonLdUtils.DeepCompare(result, conformanceCase.output)) { #if DEBUG Console.WriteLine(id); Console.WriteLine("Actual:"); Console.Write(JSONUtils.ToPrettyString(result)); Console.WriteLine("--------------------------"); Console.WriteLine("Expected:"); Console.Write(JSONUtils.ToPrettyString(conformanceCase.output)); Console.WriteLine("--------------------------"); #endif Assert.True(false, "Returned JSON doesn't match expectations."); } } }
static void Main(string[] args) { var input = GetJson("TestCases\\event-input.jsonld"); var expected = File.ReadAllText("TestCases\\event-output.nq").Replace("\\", ""); var options = new JsonLdOptions("http://json-ld.org/test-suite/tests/startup"); options.format = "application/nquads"; var result = new JValue(((string)JsonLdProcessor.ToRDF(input, options)).Replace("\n", "\r\n")); Console.WriteLine(JSONUtils.ToPrettyString(result)); Console.WriteLine(JSONUtils.ToPrettyString(result) == JSONUtils.ToPrettyString(expected)); bool isSame = JsonLdUtils.DeepCompare(result, expected); Console.WriteLine(JsonLdUtils.DeepCompare(result, expected)); }