private void AssertEqual(HttpRequestMessage recorded, HttpRequestMessage incoming) { Assert.Equal(recorded.Method, incoming.Method); Assert.Equal(recorded.RequestUri, incoming.RequestUri); var jRecorded = HttpResponeMessageConverter.SerializeRequest(recorded); var jIncoming = HttpResponeMessageConverter.SerializeRequest(incoming); Assert.True(JToken.DeepEquals(jRecorded, jIncoming)); }
private void AssertEqual(HttpRequestMessage recorded, HttpRequestMessage incoming) { Assert.Equal(recorded.Method, incoming.Method); Assert.Equal(recorded.RequestUri, incoming.RequestUri); var jRecorded = HttpResponeMessageConverter.SerializeRequest(recorded); var jIncoming = HttpResponeMessageConverter.SerializeRequest(incoming); Assert.Equal(jRecorded["Headers"]?.ToString(), jIncoming["Headers"]?.ToString()); Assert.Equal(jRecorded["Content"] == null, jIncoming["Content"] == null); if (jRecorded["Content"] != null) { Assert.Equal(jRecorded["Content"]["Headers"] == null, jIncoming["Content"]["Headers"] == null); if (jRecorded["Content"]["Headers"] != null) { Assert.Equal(jRecorded["Content"]["Headers"].ToString(), jIncoming["Content"]["Headers"].ToString()); } Assert.Equal(jRecorded["Content"]["Body"] == null, jIncoming["Content"]["Body"] == null); if (jRecorded["Content"]["Body"] != null) { Assert.Equal(jRecorded["Content"]["Body"].ToString(), jIncoming["Content"]["Body"].ToString()); } } }