public void TestWriteReadOnlyField() { ObjectWithReadOnlyField obj = new ObjectWithReadOnlyField(1); const string hexBuffer = "A162496401"; Helper.TestWrite(obj, hexBuffer); }
public void TestReadReadOnlyField() { const string hexBuffer = "A162496401"; ObjectWithReadOnlyField obj = Helper.Read <ObjectWithReadOnlyField>(hexBuffer); Assert.NotNull(obj); Assert.Equal(0, obj.Id); }
public void TestWriteReadOnlyField() { JsonSerializerOptions options = new JsonSerializerOptions(); options.SetupExtensions(); ObjectWithReadOnlyField obj = new ObjectWithReadOnlyField(1); const string json = @"{""Id"":1}"; Helper.TestWrite(obj, json, options); }
public void TestReadReadOnlyField() { JsonSerializerOptions options = new JsonSerializerOptions(); options.SetupExtensions(); const string json = @"{""Id"":1}"; ObjectWithReadOnlyField obj = Helper.Read <ObjectWithReadOnlyField>(json, options); Assert.NotNull(obj); Assert.Equal(0, obj.Id); }