ASP.NET MVC Default route and error handling
===

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:

 - ~/customer/add -> controller = customer, action = add
 - ~/customer -> controller = customer, action = list
 - ~/ -> controller = calendar, action = list

The whole routing part is unit tested (using [Phil Haack's method][1]) 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!

  [1]: http://haacked.com/archive/2007/12/16/testing-routes-in-asp.net-mvc.aspx