public void ReadWithObject() { JsonSerializerOptions options = new JsonSerializerOptions(); options.SetupExtensions(); const string json = @"{""Object"":{""IntValue"":12}}"; ObjectWithObject obj = Helper.Read <ObjectWithObject>(json, options); Assert.NotNull(obj); Assert.NotNull(obj.Object); Assert.Equal(12, obj.Object.IntValue); }
public void WriteWithObject() { JsonSerializerOptions options = new JsonSerializerOptions(); options.SetupExtensions(); const string json = @"{""Object"":{""IntValue"":12}}"; ObjectWithObject obj = new ObjectWithObject { Object = new IntObject { IntValue = 12 } }; Helper.TestWrite(obj, json, options); }