title: Get service from WebApplicationFactory<T> in ASP.NET Core integration tests
body: <p>I want to set up my tests using <code>WebApplicationFactory&lt;T&gt;</code> as detailed in 
  <a href="https://docs.microsoft.com/en-gb/aspnet/core/test/integration-tests?view=aspnetcore-2.1" rel="noreferrer" title="Integration tests in ASP.NET Core">Integration tests in ASP.NET Core</a>.</p>
  
  <p>Before some of my tests I need to use a service configured in the real Startup class to set things up.
  The problem I have is that I can't see a way to get a service from the factory.</p>
  
  <p>I could get a service from <code>factory.Server</code> using <code>factory.Host.Services.GetRequiredService&lt;ITheType&gt;();</code> except that <code>factory.Server</code> is null until <code>factory.CreateClient();</code> has been called.</p>
  
  <p>Is there any way that I am missing to get a service using the factory?</p>
  
  <p>Thanks.</p>