title: With ASP.NET/MVC + MvcMockHelpers + RhinoMocks, who sets RouteData?
body: <p>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 <a href="http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx" rel="nofollow noreferrer">MvcMockHelpers</a> (since it seems like I need that).</p>
  
  <p>My test method looks like:</p>
  
  <pre><code>var controller = new MyController();
  MvcMockHelpers.SetFakeControllerContext(mocks, controller);
  mocks.ReplayAll();
  var result = controller.MyAction(arg1, arg2);
  // then i'd make assertions on the result
  </code></pre>
  
  <p>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".</p>
  
  <p>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?</p>
  
  <p>(I feel completely lost here, so if I'm barking up the wrong tree, let me know that, too.)</p>