I am trying to write some unit tests for my ApiController and faced some issues. There is a nice extension method called Request.CreateResponse that helps a lot with generat
WebAPI 1 here with a similar issue using VB.
I managed to hybrid responses here 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.