开发者

How do you unit test HTML.ActionLink

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 th开发者_C百科e best way to achieve this.


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.

Here is a short article on that topic:

  • Testing URL Generation on Routes in MVC Framework
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜