mrblah
mrblah

Reputation: 103497

unit testing asp.net routes

is there a way to test routes via nunit?

Upvotes: 1

Views: 555

Answers (2)

Kevin LaBranche
Kevin LaBranche

Reputation: 21078

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!

Upvotes: 2

Rippo
Rippo

Reputation: 22424

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

Upvotes: 1

Related Questions