Reputation: 2230
Among the bunch of specific routes defined in my application, I use the default route to map all remaining parameterless routes:
routes.MapRoute("Default", "{controller}/{action}", new { controller = "calendar", action = "list" });
With this, I obtain for instance the following routing:
The whole routing part is unit tested (using Phil Haack's method) in such that I check if the "~/customer" URL will indeed be split into controller = "customer" and action = "list".
The problem is that if I remove a controller or an action, the test will remain green since the route is still successfully mapped by the default route.
Somehow, I'd like my test to fail if the targeted controller or action are invalid. Is there a way to do this at UnitTest level?
Thanks!
Upvotes: 0
Views: 393
Reputation: 11191
You can achieve that by using MvcContrib
Please see example here for Routes Testing http://mvccontrib.codeplex.com/wikipage?title=TestHelper#Examples
Upvotes: 1