public void TestReadPrivateProperty() { const string hexBuffer = "A2624964016C5072697661746550726F703102"; ObjectWithPrivateProperty obj = Helper.Read <ObjectWithPrivateProperty>(hexBuffer); Assert.NotNull(obj); Assert.Equal(1, obj.Id); Assert.Equal(2, obj.GetProp1()); Assert.Equal(0, obj.GetProp2()); }
public void TestReadPrivateProperty() { JsonSerializerOptions options = new JsonSerializerOptions(); options.SetupExtensions(); const string json = @"{""Id"":1,""PrivateProp1"":2}"; ObjectWithPrivateProperty obj = Helper.Read <ObjectWithPrivateProperty>(json, options); Assert.NotNull(obj); Assert.Equal(1, obj.Id); Assert.Equal(2, obj.GetProp1()); Assert.Equal(0, obj.GetProp2()); }