I updated to the final version of MVC4 and now my tests are failing with this error:
System.MissingMethodException : Method not found: 'Void System.Net.Http.ObjectContent`1..ctor(!0, System.Net.Http.Formatting.MediaTypeFormatter, System.Net.Http.Headers.MediaTypeHeaderValue)'.
at System.Net.Http.HttpRequestMessageExtensions.CreateResponse(HttpRequestMessage request, HttpStatusCode statusCode, T value, HttpConfiguration configuration)
On my unit test I have (it was working with RC version):
var configuration = new HttpConfiguration();
var request = new HttpRequestMessage();
var controller = ClassUnderTest;
controller.Request = request;
controller.Request.Properties["MS_HttpConfiguration"] = configuration;
When I run my test I have the exception on this line of code inside the controller:
return Request.CreateResponse(HttpStatusCode.Created, myObj);
I tried different things but I could not fix the tests. Any ideas?
I solved the problem and it was quite simple.
I unistalled the NuGet packages relative to the RC version and installed the the new one. This solve the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With