Exemplo n.º 1
0
        public void PropertiesReadOnlyTest()
        {
            PropertyReadOnly p_obj = new PropertyReadOnly();

            p_obj.X = 10;

            string json = JsonMapper.ToJson(p_obj);

            Assert.AreEqual("{\"X\":10,\"Y\":20}", json, "A1");

            PropertyReadOnly p_obj2 =
                JsonMapper.ToObject <PropertyReadOnly> (json);

            Assert.AreEqual(10, p_obj2.X, "A2");
            Assert.AreEqual(20, p_obj2.Y, "A3");
        }
Exemplo n.º 2
0
        public void PropertiesReadOnlyTest()
        {
            PropertyReadOnly p_obj = new PropertyReadOnly ();

            p_obj.X = 10;

            string json = JsonMapper.ToJson (p_obj);

            Assert.AreEqual ("{\"X\":10,\"Y\":20}", json, "A1");

            PropertyReadOnly p_obj2 =
                JsonMapper.ToObject<PropertyReadOnly> (json);

            Assert.AreEqual (10, p_obj2.X, "A2");
            Assert.AreEqual (20, p_obj2.Y, "A3");
        }