.NET Core TestServer returning 404 when using Startup class defined in unit test project : <p>I've a basic .net core api web app and a unit test project that uses a TestServer to make http requests.</p>

<p>I've a TestStartup class that subclassed the Startup class in the api project.</p>

<p>If the Startup class is in the unit test project i get a 404 response.
If the TestStartup class is moved to the api project i get a 200 reponse.</p>

<p>Api Project</p>

<p>Api.csproj</p>

<pre><code>&lt;PackageReference Include="Microsoft.AspNetCore.App" /&gt;
</code></pre>

<p>Program.cs</p>

<pre><code>public class Program
{
    public static void Main(string[] args)
    {
        CreateWebHostBuilder(args).Build().Run();
    }

    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =&gt;
        WebHost.CreateDefaultBuilder(args)
            .UseStartup&lt;Startup&gt;();
}
</code></pre>

<p>Startup.cs</p>

<pre><code>public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvcCore();
    }

    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        app.UseMvc();
    }
}
</code></pre>

<p>TestController.cs</p>

<pre><code>public class TestController : ControllerBase
{
    [HttpGet("test")]
    public ObjectResult Get()
    {
        return Ok("data");
    }
}
</code></pre>

<p>Unit Test Project</p>

<p>Tests.csproj</p>

<pre><code>&lt;PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.1" /&gt;
&lt;PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.1.2" /&gt;
&lt;PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.1.1" /&gt;
&lt;PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" /&gt;
&lt;PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /&gt;
&lt;PackageReference Include="NUnit" Version="3.10.1" /&gt;
&lt;PackageReference Include="NUnit3TestAdapter" Version="3.10.0" /&gt;
</code></pre>

<p>Tests.cs</p>

<pre><code>[TestFixture]
public class Tests
{
    [Test]
    public async Task Test()
    {
        var server = new TestServer(WebHost.CreateDefaultBuilder()
            .UseStartup&lt;TestStartup&gt;()
            .UseEnvironment("Development"));

        var response = await server.CreateClient().GetAsync("test");
    }
}
</code></pre>

<p>Startup.cs</p>

<pre><code>public class TestStartup : Startup
{ }
</code></pre>
