/// <summary> /// Runs the test by reading both payloads - one with the reordering reader /// the other with the regular reader and comparing the results. /// </summary> public void RunTest() { using (TextReader expectedJsonTextReader = new StringReader(this.ExpectedJsonText)) using (TextReader jsonTextReader = new StringReader(this.JsonText)) { JsonReader expectedJsonReader = new JsonReader(expectedJsonTextReader, this.assert, ODataFormat.Json, isIeee754Compatible: true); ReorderingJsonReader reorderingJsonReader = new ReorderingJsonReader(jsonTextReader, /*maxInnerErrorDepth*/int.MaxValue, this.assert, isIeee754Compatible: true); while (reorderingJsonReader.Read()) { this.assert.IsTrue(expectedJsonReader.Read(), "Reordering Json reader reports more nodes than the regular one."); this.assert.AreEqual(expectedJsonReader.NodeType, reorderingJsonReader.NodeType, "Node types don't match."); this.assert.AreEqual(expectedJsonReader.Value, reorderingJsonReader.Value, "Values don't match."); } this.assert.IsFalse(expectedJsonReader.Read(), "Reordering Json reader reports less nodes than the regular one."); } }
/// <summary> /// Runs the test by reading both payloads - one with the reordering reader /// the other with the regular reader and comparing the results. /// </summary> public void RunTest() { using (TextReader expectedJsonTextReader = new StringReader(this.ExpectedJsonText)) using (TextReader jsonTextReader = new StringReader(this.JsonText)) { JsonReader expectedJsonReader = new JsonReader(expectedJsonTextReader, this.assert, ODataFormat.Json, isIeee754Compatible: true); ReorderingJsonReader reorderingJsonReader = new ReorderingJsonReader(jsonTextReader, /*maxInnerErrorDepth*/ int.MaxValue, this.assert, isIeee754Compatible: true); while (reorderingJsonReader.Read()) { this.assert.IsTrue(expectedJsonReader.Read(), "Reordering Json reader reports more nodes than the regular one."); this.assert.AreEqual(expectedJsonReader.NodeType, reorderingJsonReader.NodeType, "Node types don't match."); this.assert.AreEqual(expectedJsonReader.Value, reorderingJsonReader.Value, "Values don't match."); } this.assert.IsFalse(expectedJsonReader.Read(), "Reordering Json reader reports less nodes than the regular one."); } }