mvccontrib test helper and verifying http post routes and parameters

后端 未结 2 557
栀梦
栀梦 2021-01-05 11:02

In my Asp.net MVC app, I have two methods on a controller, one for when the user first arrives on the view and then one when they submit the form on said view.



        
2条回答
  •  渐次进展
    2021-01-05 12:02

    Using the mvccontrib helper syntax:

    "~/account/foo".WithMethod(HttpVerbs.Post).ShouldMapTo(a => a.foo(null));
    

    You pass null as the Foo(string id, Account accountToFoo) method is never executed as part of the routing test.

提交回复
热议问题