views:

14

answers:

0

Hi, I can't find a solution to mock ControllerContext.ParentActionViewContext. here is the code of my controller


[ChildActionOnly]
public ViewResult Menu()
{
string controller = ControllerContext.ParentActionViewContext.RouteData.Values["controller"].ToString();
string action = ControllerContext.ParentActionViewContext.RouteData.Values["action"].ToString();
List menuItems = new List();

...code to populate my list...

return View(menuItems);
}

What I want to accomplish is mock ParentActionViewContext in a test so i can pass whatever controller and action I want to do my simulations. I can mock the RouteData of the ControllerContext, but I can't fake the one of the parent controller. Maybe I'm missing something obviuos.

Any help is greatly appreciated.