Exemplo n.º 1
0
        public void Can_Serialize()
        {
            var model = EdgeCaseProperties.Create(1);
            var s     = JsonSerializer.SerializeToString(model);

            Console.WriteLine(s);
        }
Exemplo n.º 2
0
        public void Can_Deserialize()
        {
            const string json = "{\"id\":\"1\",\"1\":\"1\"}";

            var model = EdgeCaseProperties.Create(1);

            var fromJson = JsonSerializer.DeserializeFromString <EdgeCaseProperties>(json);

            Assert.That(fromJson, Is.EqualTo(model));
        }
Exemplo n.º 3
0
        public void Can_Serialize_map()
        {
            var model = new Dictionary <string, EdgeCaseProperties>
            {
                { "A", EdgeCaseProperties.Create(1) },
                { "B", EdgeCaseProperties.Create(2) },
            };
            var s = JsonSerializer.SerializeToString(model);

            Console.WriteLine(s);
        }
Exemplo n.º 4
0
        public void Can_Serialize_list()
        {
            var model = new List <EdgeCaseProperties>
            {
                EdgeCaseProperties.Create(1),
                EdgeCaseProperties.Create(2)
            };
            var s = JsonSerializer.SerializeToString(model);

            Console.WriteLine(s);
        }