public void ConvertHttpResponseMessageOfTtoObjectContentOfT() { ObjectContentAssert.ExecuteForEachHttpResponseMessage( HttpTestData.RepresentativeValueAndRefTypeTestDataCollection, TestDataVariations.All, (response, type, obj) => { Type convertType = obj == null ? type : obj.GetType(); ObjectContent objectContent = (ObjectContent)GenericTypeAssert.InvokeConstructor(typeof(ObjectContent <>), convertType, new Type[] { convertType }, new object[] { obj }); HttpParameterValueConverter converter = HttpParameterValueConverter.GetValueConverter(objectContent.GetType()); ObjectContent convertedContent = converter.Convert(response) as ObjectContent; Assert.IsNotNull(convertedContent, "Failed to convert to ObjectContent."); Assert.AreEqual(((ObjectContent)response.Content).ReadAs(), convertedContent.ReadAs(), "Incorrect value."); }); }