Ejemplo n.º 1
0
        public void Test_0017_JSONObjectValue_hasEntry()
        {
            JsonObject json = new JsonObject("{\"user\":{\"name\":\"kii\"}}");

            Assert.AreEqual("{\"user\":{\"name\":\"kii\"}}", json.ToString());
            Assert.AreEqual("{\"name\":\"kii\"}", json.GetJsonObject("user").ToString());
            JsonObject inner = json.GetJsonObject("user");

            Assert.AreEqual("kii", inner.GetString("name"));
        }
Ejemplo n.º 2
0
        public void Test_0016_JSONObjectValue_empty()
        {
            JsonObject json = new JsonObject("{\"id\":{}}");

            Assert.AreEqual("{\"id\":{}}", json.ToString());
            Assert.AreEqual("{}", json.GetJsonObject("id").ToString());
        }
Ejemplo n.º 3
0
        public void Test_0036_set_JSONObject_empty()
        {
            JsonObject json  = new JsonObject();
            JsonObject inner = new JsonObject();

            json.Put("user", inner);
            Assert.AreEqual("{\"user\":{}}", json.ToString());
            Assert.AreEqual("{}", json.GetJsonObject("user").ToString());
        }
Ejemplo n.º 4
0
        public void Test_0037_set_JSONObject_hasValue()
        {
            JsonObject json  = new JsonObject();
            JsonObject inner = new JsonObject();

            inner.Put("name", "kii");
            json.Put("user", inner);
            Assert.AreEqual("{\"user\":{\"name\":\"kii\"}}", json.ToString());
            Assert.AreEqual("{\"name\":\"kii\"}", json.GetJsonObject("user").ToString());
        }