title: How to Unit Test Startup.cs in .NET Core
body: <p>How do people go about Unit Testing their Startup.cs classes in a .NET Core 2 application? All of the functionality seems to be provided by Static extensions methods which aren't mockable?</p>
  <p>If you take this <code>ConfigureServices</code> method for example:</p>
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddDbContext&lt;BlogContext&gt;(options =&gt; options.UseSqlServer(Configuration.GetConnectionString(&quot;DefaultConnection&quot;)));
  
      services.AddMvc();
  }
  </code></pre>
  <p>How can I write tests to ensure that <code>AddDbContext(...)</code> &amp; <code>AddMvc()</code> are called - the choice of implementing all of this functionality via extension methods seems to have made it untestable?</p>