public void Int32OrStringWithNullDeserializesCorrectly() { string json = "{ \"path\": \"/healthz\", \"port\": null, \"scheme\": \"HTTP\" }"; HTTPGetActionV1 httpGetAction = JsonConvert.DeserializeObject <HTTPGetActionV1>(json); Assert.NotNull(httpGetAction); Assert.Equal("/healthz", httpGetAction.Path); Assert.Null(httpGetAction.Port); Assert.Equal("HTTP", httpGetAction.Scheme); }
public void Int32OrStringWithStringDeserializesCorrectly() { string json = "{ \"path\": \"/healthz\", \"port\": \"http\", \"scheme\": \"HTTP\" }"; HTTPGetActionV1 httpGetAction = JsonConvert.DeserializeObject <HTTPGetActionV1>(json); Assert.NotNull(httpGetAction); Assert.False(httpGetAction.Port.IsInt32); Assert.True(httpGetAction.Port.IsString); Assert.Equal("http", httpGetAction.Port.StringValue); Assert.Equal("HTTP", httpGetAction.Scheme); }