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

            reader.Begin().Array().String("one").String("two").String("three").EndArray().End();

            reader.ReadToken(JsonTokenClass.Array);
            reader.ReadString();
            reader.ReadString();
            reader.StepOut();
            Assert.IsTrue(reader.EOF);
        }
Ejemplo n.º 2
0
 public void ReadString()
 {
     MockedJsonReader reader = new MockedJsonReader();
     reader.Begin().String("hello").End();
    
     Assert.AreEqual("hello", reader.ReadString());
     Assert.IsTrue(reader.EOF);
 }
Ejemplo n.º 3
0
        public void ReadString()
        {
            MockedJsonReader reader = new MockedJsonReader();

            reader.Begin().String("hello").End();

            Assert.AreEqual("hello", reader.ReadString());
            Assert.IsTrue(reader.EOF);
        }
Ejemplo n.º 4
0
        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());
        }
Ejemplo n.º 5
0
        public void StepOutFromWithinNestedArray()
        {
            MockedJsonReader reader = new MockedJsonReader();

            reader.Begin().Array()
            .String("one")
            .String("two").Array()
            .String("three")
            .String("four")
            .EndArray()
            .String("five")
            .EndArray()
            .End();

            reader.ReadToken(JsonTokenClass.Array);
            reader.ReadString();
            reader.ReadString();
            reader.StepOut();
            Assert.AreEqual("five", reader.ReadString());
        }
Ejemplo n.º 6
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.º 7
0
 public void SkipFromWithinNestedArray()
 {
     MockedJsonReader reader = new MockedJsonReader();
     reader.Begin().Array()
         .String("one")
         .String("two").Array()
             .String("three")
             .String("four")
             .EndArray()
         .String("five")
         .EndArray()
     .End();
     
     reader.ReadToken(JsonTokenClass.Array);
     reader.ReadString();
     reader.ReadString();
     reader.StepOut();
     Assert.AreEqual("five", reader.ReadString());
 }
Ejemplo n.º 8
0
 public void SkipArrayAtEnd()
 {
     MockedJsonReader reader = new MockedJsonReader();
     reader.Begin().Array().String("one").String("two").String("three").EndArray().End();
     
     reader.ReadToken(JsonTokenClass.Array);
     reader.ReadString();
     reader.ReadString();
     reader.ReadString();
     Assert.AreEqual(JsonTokenClass.EndArray, reader.TokenClass);
     reader.StepOut();
     Assert.IsTrue(reader.EOF);
 }
Ejemplo n.º 9
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.º 10
0
        public void StepOutOfArrayFromMiddle()
        {
            MockedJsonReader reader = new MockedJsonReader();
            reader.Begin().Array().String("one").String("two").String("three").EndArray().End();

            reader.ReadToken(JsonTokenClass.Array);
            reader.ReadString();
            reader.ReadString();
            reader.StepOut();
            Assert.IsTrue(reader.EOF);
        }
Ejemplo n.º 11
0
 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());
 }