title: How can I get test coverage around AreaRegistration.RegisterAllAreas in ASP.NET MVC?
body: <p>So I'm shooting for 100% coverage on an MVC3 site, and we're using areas.  I can get coverage on everything else EXCEPT for this one line in <code>Application_Start</code>:</p>
  
  <pre><code>AreaRegistration.RegisterAllAreas();
  </code></pre>
  
  <p>I've already thoroughly tested each area's registration, so this really amounts to an integration test of sorts, but <strong>I'd still like to cover this somehow</strong> without having to resort to a CoverageExclude attribute or lowering the coverage percentage.</p>
  
  <p>Note that unit testing this in NUnit this explodes with the following exception snippet:</p>
  
  <pre><code>System.InvalidOperationException : This method cannot be called during the application's pre-start initialization stage. at System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() at System.Web.Compilation.BuildManager.GetReferencedAssemblies()
  </code></pre>
  
  <p>Any ideas?</p>