Ejemplo n.º 1
0
        public void ReadMember()
        {
            MockedJsonReader reader = new MockedJsonReader();

            reader.Begin().Object().Member("mon", "Monday").EndObject().End();

            reader.ReadToken(JsonTokenClass.Object);
            Assert.AreEqual("mon", reader.ReadMember());
            Assert.AreEqual("Monday", reader.ReadString());
            Assert.AreEqual(JsonTokenClass.EndObject, reader.TokenClass);
            Assert.IsFalse(reader.Read());
        }
Ejemplo n.º 2
0
        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());
        }
Ejemplo n.º 3
0
 public void ReadMember()
 {
     MockedJsonReader reader = new MockedJsonReader();
     reader.Begin().Object().Member("mon", "Monday").EndObject().End();
    
     reader.ReadToken(JsonTokenClass.Object);
     Assert.AreEqual("mon", reader.ReadMember());
     Assert.AreEqual("Monday", reader.ReadString());
     Assert.AreEqual(JsonTokenClass.EndObject, reader.TokenClass);
     Assert.IsFalse(reader.Read());
 }
Ejemplo n.º 4
0
 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());
 }