Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Route testing ASP.NET MVC4

I've been using MvcRouteUnitTester (codeplex and nuget) to run automated unit tests against my routes. A taste of what it can do:

// assert incoming route
tester.WithIncomingRequest("/Foo").ShouldMatchRoute("Foo", "Index");
tester.WithIncomingRequest("/Foo/Index").ShouldMatchRoute("Foo", "Index");

// assert outgoing route
tester.WithRouteInfo("Foo", "Index").ShouldGenerateUrl("/Foo");

It works very well... when it works. It doesn't work well with MVC4 and has not been updated for a long time.

Is there a substitute tool which works with the latest MVC, and is actively supported?

like image 516
Bobby B Avatar asked Jan 23 '13 14:01

Bobby B


2 Answers

There is a great new project created by Anthony Steele for testing routes in both MVC4 and ASP.NET Web API.

It was just released last week: https://github.com/AnthonySteele/MvcRouteTester

like image 142
Filip W Avatar answered Nov 07 '22 15:11

Filip W


Have you checked out the forked version for MVC 4?

MVC Route/URL Generation Unit Tester

like image 24
justacoder Avatar answered Nov 07 '22 14:11

justacoder