I would like to be able to unit test that an HTML.ActionLink or Url.Action will return the correct url based on my route. What is the best way to achieve this.
+2
A:
What you should do, is to test your routes. The ActionLink
method and its friends all use the routing engine to build the URLs, so if the routing is ok, the links will be ok.
This seems to be a good article on the topic:
Jørn Schou-Rode
2010-02-18 23:00:30
Link is an oldie but a goodie, in particular since Eilon owns MVC nowadays.
No Refunds No Returns
2010-02-18 23:49:09