Exemplo n.º 1
0
        public void ShouldSerializeEnumByPrimitiveValue()
        {
            const Formatting target   = Formatting.None;
            const string     expected = "0";

            JsonAssert.SerializesTo(target, expected);
        }
Exemplo n.º 2
0
        public void ShouldSerializeObjectWithTypeName()
        {
            var target = new SerializationTestTarget {
                Id = "42"
            };
            const string expected = "{\"$type\":\"" + TestTargetTypeName + "\",\"Id\":\"42\"}";

            JsonAssert.SerializesTo(target, expected);
        }
Exemplo n.º 3
0
        public void ShouldNotSerializeNullProperty()
        {
            // ReSharper disable once AssignNullToNotNullAttribute
            var target = new SerializationTestTarget {
                Id = null
            };
            const string expected = "{\"$type\":\"" + TestTargetTypeName + "\"}";

            JsonAssert.SerializesTo(target, expected);
        }
Exemplo n.º 4
0
 public void ShouldSerializeNull()
 {
     JsonAssert.SerializesTo((object)null, "null");
 }