Beispiel #1
0
        public void ShouldSerializeEnumByPrimitiveValue()
        {
            const Formatting target   = Formatting.None;
            const string     expected = "0";

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

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

            JsonAssert.SerializesTo(target, expected);
        }
Beispiel #4
0
 public void ShouldSerializeNull()
 {
     JsonAssert.SerializesTo((object)null, "null");
 }