Now when the constructor to create a response with HttpResponseMessage<T>
and content is gone how should you do it if you want to test your controller? Request.CreateResponse<T>
should be used instead and that is like such:
public HttpResponseMessage Post()
{
// Do Something
var response = Request.CreateResponse<SomeType>(System.Net.HttpStatusCode.OK, someObject);
return response;
}
Now to test a controller like this I have to stub the Request
object since that is a property on the base class and I should use it to create the response, but that is not something I like and wonder if I can do it some other way?