public async Task WriteSimpleTestStructWithNullableStructCollectionWrappers() { { SimpleTestStructWithNullableStructCollectionWrappers obj = new SimpleTestStructWithNullableStructCollectionWrappers(); obj.Initialize(); Assert.Equal(SimpleTestStructWithNullableStructCollectionWrappers.s_json.StripWhitespace(), await Serializer.SerializeWrapper(obj)); } { SimpleTestStructWithNullableStructCollectionWrappers obj = new SimpleTestStructWithNullableStructCollectionWrappers(); string json = @"{" + @"""List"" : null," + @"""Dictionary"" : null" + @"}"; Assert.Equal(json.StripWhitespace(), await Serializer.SerializeWrapper(obj)); } }
public static void ReadSimpleTestStruct_NullableStructCollectionWrappers() { { SimpleTestStructWithNullableStructCollectionWrappers obj = JsonSerializer.Deserialize <SimpleTestStructWithNullableStructCollectionWrappers>(SimpleTestStructWithNullableStructCollectionWrappers.s_json); obj.Verify(); } { string json = @"{" + @"""List"" : null," + @"""Dictionary"" : null" + @"}"; SimpleTestStructWithNullableStructCollectionWrappers obj = JsonSerializer.Deserialize <SimpleTestStructWithNullableStructCollectionWrappers>(json); Assert.False(obj.List.HasValue); Assert.False(obj.Dictionary.HasValue); } }
public async Task ReadSimpleTestStruct_NullableStructCollectionWrappers() { { SimpleTestStructWithNullableStructCollectionWrappers obj = await JsonSerializerWrapperForString.DeserializeWrapper <SimpleTestStructWithNullableStructCollectionWrappers>(SimpleTestStructWithNullableStructCollectionWrappers.s_json); obj.Verify(); } { string json = @"{" + @"""List"" : null," + @"""Dictionary"" : null" + @"}"; SimpleTestStructWithNullableStructCollectionWrappers obj = await JsonSerializerWrapperForString.DeserializeWrapper <SimpleTestStructWithNullableStructCollectionWrappers>(json); Assert.False(obj.List.HasValue); Assert.False(obj.Dictionary.HasValue); } }