Ejemplo n.º 1
0
        public void ShouldNotSerializeNullPropertyWhenFormatting()
        {
            // ReSharper disable once AssignNullToNotNullAttribute
            var target = new SerializationTestTarget {
                Id = null
            };
            const string expected = "{\r\n" +
                                    "    \"$type\": \"" + TestTargetTypeName + "\"\r\n" +
                                    "}";
            var actual = target.ToFormattedJson();

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void ShouldSerializeFormatted()
        {
            var target = new SerializationTestTarget {
                Id = "666"
            };
            const string expected = "{\r\n" +
                                    "    \"$type\": \"" + TestTargetTypeName + "\",\r\n" +
                                    "    \"Id\": \"666\"\r\n" +
                                    "}";
            var actual = target.ToFormattedJson();

            Assert.AreEqual(expected, actual);
        }