public void CloneIsAtSamePosition() { Assert.IsNotNull(EqualityComparer<NavigatorState>.Default); var nav = buildNav(); var nav2 = buildNav(); Assert.IsTrue(nav.IsSamePosition(nav2)); Assert.IsTrue(nav.MoveToFirstChild()); Assert.IsTrue(nav.MoveToFirstChild()); // nodeA // Just checking, it should NOT be the same position Assert.IsFalse(nav.IsSamePosition(nav2)); Assert.IsTrue(nav.MoveToNext()); // nodeB[0] Assert.IsTrue(nav.MoveToNext()); // nodeB[1] // Navigate the same with nav2 Assert.IsTrue(nav2.MoveToFirstChild()); Assert.IsTrue(nav2.MoveToFirstChild()); // nodeA Assert.IsTrue(nav2.MoveToNext()); // nodeB[0] Assert.IsTrue(nav2.MoveToNext()); // nodeB[1] // Now, they should have arrived at the same position Assert.IsTrue(nav.IsSamePosition(nav2)); var nav3 = new JsonXPathNavigator(nav); Assert.IsTrue(nav.IsSamePosition(nav3)); Assert.IsTrue(nav2.IsSamePosition(nav3)); }
public JsonXPathNavigator(JsonXPathNavigator source) { copyState(source._state); _nameTable = source._nameTable; }