Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Unit testing Routes not working 404 or 406

$
0
0

We have an issue doing end-to-end integration testing, the routes do not seem to be connecting WebRequests with their respective ApiControllers.

In one scenario, we are setting up with an HttpConfiguration, HttpServer, and passing the server to an HttpClient as its message handler. We are configuring an HttpRequestMessage and expecting the HttpResponseMessage back. Error 404.

In another scenario, we are setting up with HttpSelfHostConfiguration, HttpSelfHostServer, opening the server, then configuring and getting a (failing) response back from a WebResponse (or HttpWebResponse, if you will). Error 404.

That I know of the IDependencyResolver is trying to resolve dependencies. Resolving the controller itself behind the route is no problem. We also had a configuration step where we were replacing the default IContentNegotiator with a more restrictive setting. Error 406 under these circumstances.

I'm not sure we should be removing the formatters as well, Xml (from production examples), and/or Json, since this is self-host.

The route we are trying to map, as far as I know, and/or that anyone can tell me, is correct. Do we need to map all of the routes, and/or comprehend the conventions, in order for resolution to be happy?

Kind of at a loss at this point.

Thank you...


Viewing all articles
Browse latest Browse all 4850


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>