Route testing ASP.NET MVC4

非 Y 不嫁゛ 提交于 2019-12-19 02:47:07

问题


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?


回答1:


Have you checked out the forked version for MVC 4?

MVC Route/URL Generation Unit Tester




回答2:


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



来源:https://stackoverflow.com/questions/14482346/route-testing-asp-net-mvc4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!