Rajeesh
Rajeesh

Reputation: 4495

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

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.Format("{0}/{{Page}}/{{PageSize}}/{{Sort}}", controller.Name),
                       controller.Index().AddRouteValues(new DefaultPaging()));

Upvotes: 1

Views: 95

Answers (0)

Related Questions