I'm trying to write a test for an ASP.NET MVC controller method. I've got RhinoMocks (since it seems to be the most popular and best supported), and MvcMockHelpers (since it seems like I need that).
My test method looks like:
var controller = new MyController();
MvcMockHelpers.SetFakeControllerContext(mocks, controller);
mocks.ReplayAll();
var result = controller.MyAction(arg1, arg2);
// then i'd make assertions on the result
This doesn't work, because the RouteData has no entries, and MyAction depends on having a bunch of values set there, like "controller" and "action".
I know I can build a custom RouteData for each controller method I want to call, but that seems silly. What part of ASP.NET MVC is responsible for setting this, and how can I get in that code path?
(I feel completely lost here, so if I'm barking up the wrong tree, let me know that, too.)