How can you unit test ASP.NET Web API routing?

I have written a blog post about testing routes and doing pretty much what you are asking about:

http://www.strathweb.com/2012/08/testing-routes-in-asp-net-web-api/

Hope it helps.

Additional advantage is that I used reflection to provide action methods – so instead of using routes with strings, you do add them in a strongly typed manner. With this approach, if your action names ever change, the tests won’t compile so you will easily be able to spot errors.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)