public void convert_simple_type_with_null() { var sample = new MyType1 { Region = null }; var expected = @$ "{{" "Region" ":null}}"; var json = JsonSerializer.Serialize(sample, SerOptions); var inst = JsonSerializer.Deserialize <MyType1>(json, SerOptions); Assert.Equal(expected, json); Assert.Equal(sample.Region, inst.Region); }
public void convert_simple_type_with_value() { var sample = new MyType1 { Region = CloudWatchRegion.AfSouth1 }; var expected = @$ "{{" "Region" ":" "{CloudWatchRegion.AfSouth1}" "}}"; var json = JsonSerializer.Serialize(sample, SerOptions); var inst = JsonSerializer.Deserialize <MyType1>(json, SerOptions); Assert.Equal(expected, json); Assert.Equal(sample.Region, inst.Region); Assert.Equal(sample.Region.Value, inst.Region.Value); }
public void MapTwoTrackFunction_OfSome_MapsToNewSome() { Option <MyType1> option = new MyType1(); Option <string> result = option.Map(mt => mt.ToString().NoneIfNull()); if (result is Some <string> some) { Assert.AreEqual(nameof(MyType1), some.Content); } else { Assert.Fail(); } }