title: How do I test area registration logic in MVC 3?
body: <p>I have simple HttpApplication class:</p>
  
  <pre><code>public class MvcApplication : HttpApplication
  {
      public void Application_Start()
      {
          // register areas
          AreaRegistration.RegisterAllAreas();
  
          // register other stuff...
      }
  }
  </code></pre>
  
  <p>My unit tests initialise <code>HttpApplication</code>, invoke <code>ApplicationStart</code> and verify application start-up behaviour.</p>
  
  <p>This approach worked well until I had to integrate MVC areas. When <code>AreaRegistration.RegisterAllAreas()</code> is invoked by a unit test, the following exception gets thrown:</p>
  
  <p><code>System.InvalidOperationException: This method cannot be called during the application's pre-start initialization stage.</code></p>
  
  <p>Is there a good approach for testing area initialisation logic?</p>