I\'m using ASP.Net MVC 4 RC\'s ApiController and I\'m trying to unit test a GET method.
This method uses the CreateResponse
method that\'s on t
WebAPI 1 with VB here!
I managed to hybrid responses from your link above to get this to work as simple as this:
Dim request As HttpRequestMessage = New HttpRequestMessage()
Return request.CreateResponse(HttpStatusCode.BadRequest, myCustomClassObject, GlobalConfiguration.Configuration)
Just posting in case it helps anyone.
This was solved by specifying an empty configuration:
request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
I got the answer to that from here
ASP.NET WebApi unit testing with Request.CreateResponse