public void SkipAdjacentObjects() { MockedJsonReader reader = new MockedJsonReader(); reader.Begin().Array().Object().EndObject().Object().EndObject().EndArray().End(); reader.ReadToken(JsonTokenClass.Array); reader.Skip(); Assert.AreEqual(JsonTokenClass.Object, reader.TokenClass); reader.Skip(); reader.ReadToken(JsonTokenClass.EndArray); }
public void SkipArray() { MockedJsonReader reader = new MockedJsonReader(); reader.Begin().Array().String("test").EndArray().End(); reader.Skip(); Assert.IsTrue(reader.EOF); }
public void SkipObject() { MockedJsonReader reader = new MockedJsonReader(); reader.Begin().Object().Member("foo", "bar").EndObject().End(); reader.Skip(); Assert.IsTrue(reader.EOF); }
public void SkipScalar() { var reader = new MockedJsonReader(); reader.Begin().String("test").End(); reader.Skip(); Assert.IsTrue(reader.EOF); }
public void SkipArrayElement() { MockedJsonReader reader = new MockedJsonReader(); reader.Begin().Array().String("foo").String("bar").EndArray().End(); reader.Read(); reader.Read(); reader.Skip(); Assert.AreEqual("bar", reader.ReadString()); }
public void SkipObjectMember() { MockedJsonReader reader = new MockedJsonReader(); reader.Begin().Object() .Member("m1", "v1") .Member("m2").Object() .Member("m3", "v3") .Member("m4", "v4") .EndObject() .Member("m5", "v5") .EndObject() .End(); reader.Read(); reader.Read(); reader.Skip(); Assert.AreEqual(JsonTokenClass.Member, reader.TokenClass); Assert.AreEqual("m2", reader.Text); reader.Skip(); Assert.AreEqual("m5", reader.ReadMember()); }
public void SkipScalar() { MockedJsonReader reader = new MockedJsonReader(); reader.Begin().String("test").End(); reader.Skip(); Assert.IsTrue(reader.EOF); }