Ejemplo n.º 1
0
        public void Test_0106_long_to_double()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10L);
            Assert.AreEqual(10.00, json.GetDouble("f"));
        }
Ejemplo n.º 2
0
        public void Test_0120_string_to_bool()
        {
            JsonObject json = new JsonObject();

            json.Put("f", "10.01");
            json.GetBoolean("f");
        }
Ejemplo n.º 3
0
        public void Test_0103_int_to_bool()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10);
            json.GetBoolean("f");
        }
Ejemplo n.º 4
0
        public void Test_0114_bool_to_long()
        {
            JsonObject json = new JsonObject();

            json.Put("f", true);
            json.GetLong("f");
        }
Ejemplo n.º 5
0
        public void Test_0117_string_to_int()
        {
            JsonObject json = new JsonObject();

            json.Put("f", "10.01");
            Assert.AreEqual(10, json.GetInt("f"));
        }
Ejemplo n.º 6
0
        public void Test_0118_string_to_long()
        {
            JsonObject json = new JsonObject();

            json.Put("f", "10.01");
            Assert.AreEqual(10L, json.GetLong("f"));
        }
Ejemplo n.º 7
0
        public void Test_0116_bool_to_string()
        {
            JsonObject json = new JsonObject();

            json.Put("f", true);
            Assert.AreEqual("true", json.GetString("f"));
        }
Ejemplo n.º 8
0
        public void Test_0119_string_to_double()
        {
            JsonObject json = new JsonObject();

            json.Put("f", "10.01");
            Assert.AreEqual(10.01, json.GetDouble("f"));
        }
Ejemplo n.º 9
0
        public void Test_0105_long_to_int()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10L);
            Assert.AreEqual(10, json.GetInt("f"));
        }
Ejemplo n.º 10
0
        public void Test_0107_long_to_bool()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10L);
            json.GetBoolean("f");
        }
Ejemplo n.º 11
0
        public void Test_0112_double_to_string()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10.01);
            Assert.AreEqual("10.01", json.GetString("f"));
        }
Ejemplo n.º 12
0
        public void Test_0113_bool_to_int()
        {
            JsonObject json = new JsonObject();

            json.Put("f", true);
            json.GetInt("f");
        }
Ejemplo n.º 13
0
        public void Test_0110_double_to_long()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10.00);
            Assert.AreEqual(10L, json.GetLong("f"));
        }
Ejemplo n.º 14
0
        public void Test_0111_double_to_bool()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10.00);
            json.GetBoolean("f");
        }
Ejemplo n.º 15
0
        public void Test_0108_long_to_string()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10L);
            Assert.AreEqual("10", json.GetString("f"));
        }
Ejemplo n.º 16
0
        public void Test_0109_double_to_int()
        {
            JsonObject json = new JsonObject();

            json.Put("f", 10.00);
            Assert.AreEqual(10, json.GetInt("f"));
        }
Ejemplo n.º 17
0
        public void Test_0115_bool_to_double()
        {
            JsonObject json = new JsonObject();

            json.Put("f", true);
            json.GetDouble("f");
        }
Ejemplo n.º 18
0
        public void Test_0034_set_true()
        {
            JsonObject json = new JsonObject();

            json.Put("id", true);
            Assert.AreEqual("{\"id\":true}", json.ToString());
            Assert.AreEqual(true, json.GetBoolean("id"));
        }
Ejemplo n.º 19
0
        public void Test_0033_set_Double()
        {
            JsonObject json = new JsonObject();

            json.Put("id", (double)12345.678901234);
            Assert.AreEqual("{\"id\":12345.678901234}", json.ToString());
            Assert.AreEqual((double)12345.678901234, json.GetDouble("id"));
        }
Ejemplo n.º 20
0
        public void Test_0031_set_Int()
        {
            JsonObject json = new JsonObject();

            json.Put("id", (int)1234);
            Assert.AreEqual("{\"id\":1234}", json.ToString());
            Assert.AreEqual(1234, json.GetInt("id"));
        }
Ejemplo n.º 21
0
        public void Test_0035_set_false()
        {
            JsonObject json = new JsonObject();

            json.Put("id", false);
            Assert.AreEqual("{\"id\":false}", json.ToString());
            Assert.AreEqual(false, json.GetBoolean("id"));
        }
Ejemplo n.º 22
0
        public void Test_0112_DoubleValue_MIN()
        {
            JsonObject json = new JsonObject();

            json.Put("value", double.MinValue);
            Assert.AreEqual("{\"value\":-1.7976931348623157E+308}", json.ToString());
            Assert.AreEqual(double.MinValue, json.GetDouble("value"));
        }
Ejemplo n.º 23
0
        public void Test_0111_LongValue_MIN()
        {
            JsonObject json = new JsonObject();

            json.Put("value", long.MinValue);
            Assert.AreEqual("{\"value\":" + long.MinValue + "}", json.ToString());
            Assert.AreEqual(long.MinValue, json.GetLong("value"));
        }
Ejemplo n.º 24
0
        public void Test_0110_IntValue_MIN()
        {
            JsonObject json = new JsonObject();

            json.Put("value", int.MinValue);
            Assert.AreEqual("{\"value\":" + int.MinValue + "}", json.ToString());
            Assert.AreEqual(int.MinValue, json.GetInt("value"));
        }
Ejemplo n.º 25
0
        public void Test_0030_set_String()
        {
            JsonObject json = new JsonObject();

            json.Put("id", "abcd");
            Assert.AreEqual("{\"id\":\"abcd\"}", json.ToString());
            Assert.AreEqual("abcd", json.GetString("id"));
        }
Ejemplo n.º 26
0
        public void Test_0032_set_Long()
        {
            JsonObject json = new JsonObject();

            json.Put("id", (long)123456789012345);
            Assert.AreEqual("{\"id\":123456789012345}", json.ToString());
            Assert.AreEqual((long)123456789012345, json.GetLong("id"));
        }
Ejemplo n.º 27
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.º 28
0
        public void Test_0038_set_JSONArray_empty()
        {
            JsonObject json  = new JsonObject();
            JsonArray  inner = new JsonArray();

            json.Put("ids", inner);
            Assert.AreEqual("{\"ids\":[]}", json.ToString());
            Assert.AreEqual("[]", json.GetJsonArray("ids").ToString());
        }
Ejemplo n.º 29
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());
        }
Ejemplo n.º 30
0
        public void Test_0039_set_JSONArray_hasValue()
        {
            JsonObject json  = new JsonObject();
            JsonArray  inner = new JsonArray();

            inner.Put(1234);
            json.Put("ids", inner);
            Assert.AreEqual("{\"ids\":[1234]}", json.ToString());
            Assert.AreEqual("[1234]", json.GetJsonArray("ids").ToString());
        }