Пример #1
0
        public void StructWithStaticTest()
        {
            HasStatic s = new HasStatic();

            s.someProp = 123;
            HasStatic.someStaticProp = 456;

            string json = JsonUtil.ToJson(s);

            Assert.That(json, Is.Not.Contains("someStaticProp"));

            string    j  = "{\"someProp\":123,\"someStaticProp\":789}";
            HasStatic s2 = JsonUtil.ToObject <HasStatic>(j);

            Assert.AreEqual(s2.someProp, 123);
            Assert.AreEqual(HasStatic.someStaticProp, 456);
        }
Пример #2
0
        public void StructWithStaticTest()
        {
            HasStatic s = new HasStatic();

            s.someProp = 123;
            HasStatic.someStaticProp = 456;

            string json = Serialize.From(s);

            Assert.AreEqual(false, json.Contains("someStaticProp"));

            string    j  = "{\"someProp\":123,\"someStaticProp\":789}";
            HasStatic s2 = Deserialize.To <HasStatic>(j);

            Assert.AreEqual(s2.someProp, 123);
            Assert.AreEqual(HasStatic.someStaticProp, 456);
        }