views:

57

answers:

1

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
Link is an oldie but a goodie, in particular since Eilon owns MVC nowadays.
No Refunds No Returns