I tried converting the solution to .NET 4.0 - but it was too time consuming to do so. Instead I ripped out the pieces I needed, i.e. the route testing extension methods, and built a new assembly targeting the right versions of the framework. And I replaced RhinoMocks with Moq.
Using the Mvc.TestHelper assembly you can easily test routes with syntax like this:
"~/".ShouldMapTo<HomeController>(x => x.Index());
"~/Account/".ShouldMapTo<AccountController>(x => x.Register(null));
Note: I take zero credit for this work. All the source code is taken directly from the MVCContrib project.
I have made the source available on BitBucket so that you can test your MVC 3 routes. The project uses NUnit and Moq for testing.
4 comments:
I was looking for something precisely like this. I took your route testing source and dropped NUnit for the MSTest assembly, since my current project is MSTest-based. I rebuilt and it's working great testing my MVC3 RC2 routes.
Thanks for sharing the source!
Hi Joe,
I'm really happy this was useful to you. The credit really goes to the MCVContrib guys, though, as that's where I got this code from.
Thanks for leaving your comment.
Cheers,
Øyvind
Source is no longer available :(
The link to the source code has been updated....
Post a Comment