public void TopLevelPropertiesWithNullValue() { IJsonRpcMessageFactory factory = this.formatter; var requestMessage = factory.CreateRequestMessage(); Assert.NotNull(requestMessage); requestMessage.Method = "test"; Assert.True(requestMessage.TrySetTopLevelProperty <string?>("testProperty", null)); var roundTripMessage = this.Roundtrip(requestMessage); Assert.True(roundTripMessage.TryGetTopLevelProperty("testProperty", out string?value)); Assert.Null(value); }
public void TopLevelPropertiesCanBeSerializedRequest() { IJsonRpcMessageFactory factory = this.formatter; var requestMessage = factory.CreateRequestMessage(); Assert.NotNull(requestMessage); requestMessage.Method = "test"; Assert.True(requestMessage.TrySetTopLevelProperty("testProperty", "testValue")); Assert.True(requestMessage.TrySetTopLevelProperty("objectProperty", new CustomType() { Age = 25 })); var roundTripMessage = this.Roundtrip(requestMessage); Assert.True(roundTripMessage.TryGetTopLevelProperty("testProperty", out string?value)); Assert.Equal("testValue", value); Assert.True(roundTripMessage.TryGetTopLevelProperty("objectProperty", out CustomType? customObject)); Assert.Equal(25, customObject?.Age); }