public void AnnotatedCustomStructFormatterNullValueIncludeNullsUtf8() { var input = new AnnotatedCustomStructHelper { S = null }; var serialized = JsonSerializer.Generic.Utf8.Serialize <AnnotatedCustomStructHelper, IncludeNullsOriginalCaseResolver <byte> >(input); Assert.NotNull(serialized); var deserialized = JsonSerializer.Generic.Utf8.Deserialize <AnnotatedCustomStructHelper, IncludeNullsOriginalCaseResolver <byte> >(serialized); Assert.Equal(input.S, deserialized.S); }
public void AnnotatedCustomStructFormatterExcludeNullsUtf16() { var input = new AnnotatedCustomStructHelper { S = new AnnotatedCustomStruct { Value = 1, } }; var serialized = JsonSerializer.Generic.Utf16.Serialize <AnnotatedCustomStructHelper, ExcludeNullsOriginalCaseResolver <char> >(input); Assert.NotNull(serialized); var deserialized = JsonSerializer.Generic.Utf16.Deserialize <AnnotatedCustomStructHelper, ExcludeNullsOriginalCaseResolver <char> >(serialized); Assert.Equal(input.S, deserialized.S); }