开发者

How to verify the parameter of an action method with MVCContrib Route TestHelper

开发者 https://www.devze.com 2023-02-19 08:38 出处:网络
I have an action method which has pagination object as parameter public override ActionResult Index(Paging paging)

I have an action method which has pagination object as parameter

  public override ActionResult Index(Paging paging) 
  {
        .......
        return View(...);
  }

So how could I verify the url to match action method and it's parameter? like below

Paging paging = new DefaultPaging();
"/Search".ShouldMapTo<SearchController>(action => action.Index(paging));

Update

Here is how the route definition looks like, Page,PageSize and Sort are member of the Paging class

routes.MapRoute(controller.Name, string.F开发者_StackOverflow中文版ormat("{0}/{{Page}}/{{PageSize}}/{{Sort}}", controller.Name),
                       controller.Index().AddRouteValues(new DefaultPaging()));
0

精彩评论

暂无评论...
验证码 换一张
取 消