public void SerializeEnumJsonTest()
        {
            string json = @"{""bar"":""foo"",""blah"":""enum2"",""field3"":""yyy""}";

            testclass tc = new testclass();

            tc.testfield  = "asdasd";
            tc.testfield2 = testenum.foo;
            tc.testfield3 = testenum0.xxx;
            tc.FromJsonIntermediateObject(JsonConvertibleObject.DeserializeFromJson(json));
            Assert.AreEqual("foo", tc.testfield);
            Assert.AreEqual(testenum.bar, tc.testfield2);
            Assert.AreEqual(testenum0.yyy, tc.testfield3);

            string json2 = tc.SerializeToJson();

            Assert.AreEqual(json, json2);
        }
コード例 #2
0
        public void SerializeEnumJsonTest()
        {
            string json = @"{""bar"":""foo"",""blah"":""enum2"",""field3"":""yyy""}";

            testclass tc = new testclass();
            tc.testfield = "asdasd";
            tc.testfield2 = testenum.foo;
            tc.testfield3 = testenum0.xxx;
            tc.FromJsonIntermediateObject(JsonConvertibleObject.DeserializeFromJson(json));
            Assert.AreEqual("foo", tc.testfield);
            Assert.AreEqual(testenum.bar, tc.testfield2);
            Assert.AreEqual(testenum0.yyy, tc.testfield3);

            string json2 = tc.SerializeToJson();

            Assert.AreEqual(json, json2);
        }