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); }
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); }