Beispiel #1
0
        public void ReadJsonString()
        {
            var reader = new JsonReaderBody();
            var body   = reader.ReadByFile(@".\simple_json_str.json");

            Assert.AreEqual("value", body["key"].GetValue().ToString());
        }
Beispiel #2
0
        public void ReadJsonList()
        {
            var reader = new JsonReaderBody();
            var body   = reader.ReadByFile(@".\simple_json_list.json");

            Assert.AreEqual(4, (body["key"].GetValue() as List <Json>).Count);
        }
Beispiel #3
0
        public void ReadJsonInt()
        {
            var reader = new JsonReaderBody();
            var body   = reader.ReadByFile(@".\simple_json_int.json");

            Assert.AreEqual(1, int.Parse(body["int"].GetValue().ToString()));
            Assert.AreEqual(2, int.Parse(body["int2"].GetValue().ToString()));
        }
Beispiel #4
0
        public void ReadJsonObject()
        {
            var reader = new JsonReaderBody();
            var body   = reader.ReadByFile(@".\simple_json_obj.json");

            Assert.AreEqual("Robson", body["person"]["name"].GetValue().ToString());
            Assert.AreEqual(30, int.Parse(body["person"]["age"].GetValue().ToString()));
            Assert.AreEqual("Cleyton", body["person"]["children"]["name"].GetValue().ToString());
            Assert.AreEqual(14, int.Parse(body["person"]["children"]["age"].GetValue().ToString()));
        }