Example #1
0
        public void JSON04()
        {
            var d1 = new Doc1 {
                V1 = EntityId.Parse("abc@def::abc@def::456"), V2 = EntityId.Parse("lic:::::")
            };
            var json = d1.ToJson(JsonWritingOptions.PrettyPrintRowsAsMap);

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

            got.See();

            Aver.AreEqual("abc@def::456", got.V1.Address);
            Aver.AreEqual(":::", got.V2.Value.Address);
        }
Example #2
0
        public void JSON03()
        {
            var d1 = new Doc1 {
                V1 = EntityId.Parse("abc@def::12:15:178"), V2 = EntityId.Parse("lic::i9973od")
            };
            var json = d1.ToJson(JsonWritingOptions.PrettyPrintRowsAsMap);

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

            got.See();

            Aver.AreEqual(d1.V1, got.V1);
            Aver.AreEqual(d1.V2, got.V2);
        }
Example #3
0
        public void JSON06()
        {
            var d1 = new Doc1 {
                V1 = EntityId.Parse("abc.int@sys1::address1"), V2 = null
            };
            var json = d1.ToJson(JsonWritingOptions.PrettyPrintRowsAsMap);

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

            got.See();

            Aver.AreEqual("sys1", got.V1.System.Value);
            Aver.AreEqual("int", got.V1.Schema.Value);
            Aver.AreEqual("address1", got.V1.Address);

            Aver.IsTrue(got.V2 == null);
        }
Example #4
0
        public void Test001()
        {
            var doc = new Doc1 {
                F1 = "one"
            };

            Aver.AreEqual("one+two", doc.F2);

            doc.Schema.See();

            var json = doc.ToJson();

            json.See();

            var doc2 = JsonReader.ToDoc <Doc1>(json);

            doc2.See();
        }
        public void FullCycle_doc1()
        {
            var comparer = new DocLogicalComparer();

            var d1 = new Doc1()
            {
                S1 = "in d1"
            };

            var json = d1.ToJson(JsonWritingOptions.PrettyPrintRowsAsMap);

            var d2 = JsonReader.ToDoc <Doc1>(json);

            d1.See("d1");
            json.See("JSON");
            d2.See("d2");

            var diff = comparer.Compare(d1, d2);

            diff.See();
            Aver.IsTrue(diff.AreSame);
        }