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

            var json = map.ToJSON(JSONWritingOptions.PrettyPrint);

            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();

            Aver.IsNotNull(read);

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

            var json = map.ToJSON(JSONWritingOptions.Compact);

            Console.WriteLine(json);

            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);
        }
Exemple #3
0
        public void StringMap_Pretty()
        {
            var map = new StringMap
            {
              {"p1", "v1"},
              {"p2", "v2"},
              {"Age", "149"}
            };

            var json = map.ToJSON(JSONWritingOptions.PrettyPrint);
            Console.WriteLine(json);

            dynamic read = json.JSONToDynamic();
            Assert.IsNotNull(read);

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

            var json = map.ToJSON(JSONWritingOptions.Compact);
            Console.WriteLine(json);

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

            dynamic read = json.JSONToDynamic();
            Assert.IsNotNull(read);

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