我有 2 条路线注册如下:
routes.MapRoute("GetAnEmail", "{controller}", new { controller = "Home", action = "GetAnEmail" }, new { httpMethod = new HttpMethodConstraint("POST") })
routes.MapRoute("Home", "{controller}/{action}", new { controller = "Home", action = "Index" })
我对 Home 控制器进行了有效的单元测试,如下所示:
[Test]
public void CanVerifyRouteMaps()
{
"~/".Route().ShouldMapTo<HomeController>(x => x.Index());
}
我知道 GetAnEmail 有效,但是一个单元如何测试 POSTed 路由?