Example #1
0
        public void StringMap_Pretty()
        {
            var map = new StringMap
            {
                { "p1", "v1" },
                { "p2", "v2" },
                { "Age", "149" }
            };

            var json = map.ToJson(JsonWritingOptions.PrettyPrint);

            json.See();

            dynamic read = json.JsonToDynamic();

            Aver.IsNotNull(read);

            Aver.AreEqual("v1", read.p1);
            Aver.AreEqual("v2", read.p2);
            Aver.AreEqual("149", read.Age);
        }
Example #2
0
        public void StringMap_Compact()
        {
            var map = new StringMap
            {
                { "p1", "v1" },
                { "p2", "v2" },
                { "Age", "149" }
            };

            var json = map.ToJson(JsonWritingOptions.Compact);

            json.See();

            Aver.AreEqual(@"{""p1"":""v1"",""p2"":""v2"",""Age"":""149""}", json);

            dynamic read = json.JsonToDynamic();

            Aver.IsNotNull(read);

            Aver.AreEqual("v1", read.p1);
            Aver.AreEqual("v2", read.p2);
            Aver.AreEqual("149", read.Age);
        }