开发者

unit testing asp.net routes

开发者 https://www.devze.com 2022-12-14 09:14 出处:网络
is there a way to test routes开发者_运维知识库 via nunit?Rippo\'s examples are good.I am using MVCContrib\'s TestHelper library.

is there a way to test routes开发者_运维知识库 via nunit?


Rippo's examples are good. I am using MVCContrib's TestHelper library.

It makes testing the route a breeze and is very easy to setup/use in nunit.

The test is extremely easy to construct and understand:

"~/".ShouldMapTo<HomeController>(x => x.Index());  

"~/recipe".ShouldMapTo<RecipeController>(x => x.List());  

I have a blog post using TestHelper and NUnit to test routes.

Happy coding!


See here, its a blog by the renowned Steve Sanderson. It covers unit tests and intregration tests, and uses the MvcIntegrationTestFramework

Another way is to see this post from Haacked

0

精彩评论

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

关注公众号