public void TestGetArray_OfObjectNullables()
        {
            var service = this.GetService();

            var g  = new Guid("344ac1a2-9613-44d7-b64c-8d45b4585176");
            var g2 = new Guid("344ac1a2-9613-44d7-b64c-8d45b4585178");
            var t  = new DateTime(1990, 12, 12);
            var t2 = new DateTime(1990, 10, 12);

            var jsonArray = new JsonArray();

            jsonArray.AddObject(new JsonObject()
                                .AddNullable("MyGuid", g)
                                .AddNullable("MyInt", 1)
                                .AddNullable("MyDouble", 1.5)
                                .AddNullable("MyBool", true)
                                .AddNullable("MyEnum", 1)
                                .AddNullable("MyDate", t));

            jsonArray.AddObject(new JsonObject()
                                .AddNullable("MyGuid", g2)
                                .AddNullable("MyInt", 2)
                                .AddNullable("MyDouble", 2.5)
                                .AddNullable("MyBool", false)
                                .AddNullable("MyEnum", 0)
                                .AddNullable("MyDate", t2));

            var result = service.ToArray(jsonArray);

            Assert.AreEqual("[{\"MyGuid\":\"344ac1a2-9613-44d7-b64c-8d45b4585176\",\"MyInt\":1,\"MyDouble\":1.5,\"MyBool\":true,\"MyEnum\":1,\"MyDate\":\"12/12/1990 00:00:00\"},{\"MyGuid\":\"344ac1a2-9613-44d7-b64c-8d45b4585178\",\"MyInt\":2,\"MyDouble\":2.5,\"MyBool\":false,\"MyEnum\":0,\"MyDate\":\"12/10/1990 00:00:00\"}]", result);
        }
        public void TestGetArray_OfObjectNullablesNull()
        {
            var service = this.GetService();

            var jsonArray = new JsonArray();

            jsonArray.AddObject(new JsonObject()
                                .AddNullable("MyGuid", null)
                                .AddNullable("MyInt", null)
                                .AddNullable("MyDouble", null)
                                .AddNullable("MyBool", null)
                                .AddNullable("MyEnum", null)
                                .AddNullable("MyDate", null));

            jsonArray.AddObject(new JsonObject()
                                .AddNullable("MyGuid", null)
                                .AddNullable("MyInt", null)
                                .AddNullable("MyDouble", null)
                                .AddNullable("MyBool", null)
                                .AddNullable("MyEnum", null)
                                .AddNullable("MyDate", null));

            var result = service.ToArray(jsonArray);

            Assert.AreEqual("[{\"MyGuid\":null,\"MyInt\":null,\"MyDouble\":null,\"MyBool\":null,\"MyEnum\":null,\"MyDate\":null},{\"MyGuid\":null,\"MyInt\":null,\"MyDouble\":null,\"MyBool\":null,\"MyEnum\":null,\"MyDate\":null}]", result);
        }
        public void TestGetArray_OfObjects()
        {
            var service = this.GetService();

            var g  = new Guid("344ac1a2-9613-44d7-b64c-8d45b4585176");
            var g2 = new Guid("344ac1a2-9613-44d7-b64c-8d45b4585178");
            var t  = new DateTime(1990, 12, 12);
            var t2 = new DateTime(1990, 10, 12);

            var jsonArray = new JsonArray();

            jsonArray.AddObject(new JsonObject()
                                .AddString("MyGuid", g.ToString())
                                .AddNumber("MyInt", 1)
                                .AddNumber("MyDouble", 1.5)
                                .AddBool("MyBool", true)
                                .AddNumber("MyEnum", 1)
                                .AddString("MyDate", t.ToString())
                                .AddObject("MyObj", new JsonObject().AddString("MyInnerString", "my \"inner\" value 1"))
                                .AddArray("MyList", new JsonArray().AddString("a1").AddString("b1"))
                                .AddArray("MyArray", new JsonArray().AddString("y1").AddString("z1")));

            jsonArray.AddObject(new JsonObject()
                                .AddString("MyGuid", g2.ToString())
                                .AddNumber("MyInt", 2)
                                .AddNumber("MyDouble", 2.5)
                                .AddBool("MyBool", false)
                                .AddNumber("MyEnum", 0)
                                .AddString("MyDate", t2.ToString())
                                .AddObject("MyObj", new JsonObject().AddString("MyInnerString", "my \"inner\" value 2"))
                                .AddArray("MyList", new JsonArray().AddString("a2").AddString("b2"))
                                .AddArray("MyArray", new JsonArray().AddString("y2").AddString("z2")));

            var result = service.ToArray(jsonArray);

            Assert.AreEqual("[{\"MyGuid\":\"344ac1a2-9613-44d7-b64c-8d45b4585176\",\"MyInt\":1,\"MyDouble\":1.5,\"MyBool\":true,\"MyEnum\":1,\"MyDate\":\"12/12/1990 00:00:00\",\"MyObj\":{\"MyInnerString\":\"my \\\"inner\\\" value 1\"},\"MyList\":[\"a1\",\"b1\"],\"MyArray\":[\"y1\",\"z1\"]},{\"MyGuid\":\"344ac1a2-9613-44d7-b64c-8d45b4585178\",\"MyInt\":2,\"MyDouble\":2.5,\"MyBool\":false,\"MyEnum\":0,\"MyDate\":\"12/10/1990 00:00:00\",\"MyObj\":{\"MyInnerString\":\"my \\\"inner\\\" value 2\"},\"MyList\":[\"a2\",\"b2\"],\"MyArray\":[\"y2\",\"z2\"]}]", result);
        }