Beispiel #1
0
        public void Case04_concrete()
        {
            var d1 = new ADoc {
                Name = "ADoc name", A = 100
            };
            var json = d1.ToJson();

            var got = JsonReader.ToDoc <ADoc>(json);

            Aver.IsNotNull(got);
            Aver.AreEqual("ADoc name", got.Name);
            Aver.AreEqual(100, got.A);
        }
Beispiel #2
0
        public void Case02_abstract_typeof()
        {
            var d1 = new ADoc {
                Name = "ADoc name", A = 100
            };
            var json = d1.ToJson();

            json.See();

            var got = JsonReader.ToDoc(typeof(BaseDoc), json) as ADoc;

            Aver.IsNotNull(got);
            Aver.AreEqual("ADoc name", got.Name);
            Aver.IsTrue(got is ADoc);
            Aver.AreEqual(100, ((ADoc)got).A);
        }
Beispiel #3
0
        public void Case03_new()
        {
            var d1 = new ADoc {
                Name = "ADoc name", A = 100
            };
            var json = d1.ToJson();

            json.See();

            var got = new ADoc();

            JsonReader.ToDoc(got, json);

            Aver.IsNotNull(got);
            Aver.AreEqual("ADoc name", got.Name);
            Aver.AreEqual(100, got.A);
        }