title: Getting database connection string in .NET Core integration tests with xunit
body: <p>I'm doing integration tests for my .net core project.I need to get access to a connection string for my integration tests database.</p>
  
  <p>I am using my base project as reference and using its Startup file. But I am getting this error </p>
  
  <pre><code>System.ArgumentNullException : Value cannot be null.
  Parameter name: connectionString at Npgsql.EntityFrameworkCore.PostgreSQL.Utilities.Check.NotEmpty(String 
  value, String parameterName) in 
  /home/roji/projects/EFCore.PG/src/EFCore.PG/Utilities/Check.cs:line 99   
  at Microsoft.EntityFrameworkCore.NpgsqlDbContextOptionsExtensions.UseNpgsql(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 npgsqlOptionsAction) in /home/roji/projects/EFCore.PG/src/EFCore.PG/Extensions/NpgsqlDbContextOptionsExtensions.cs:line 49
  at SurveyAPI.Startup.&lt;ConfigureServices&gt;b__4_1(DbContextOptionsBuilder options)
  </code></pre>
  
  <p>My TestClientProvider class</p>
  
  <pre><code>public class TestClientProvider
  {
      public HttpClient Client { get; private set; }
  
      public TestClientProvider()
      {   
          var server = new TestServer(new WebHostBuilder().UseStartup&lt;Startup&gt;());
  
          Client = server.CreateClient();
      }
  }
  </code></pre>
  
  <p>the test class</p>
  
  <pre><code>public class UnitTest1
  {
  
      [Fact]
      public async Task Test_Get()
      {
          var client = new TestClientProvider().Client;
  
          var response = await client.GetAsync("/api");
  
          response.EnsureSuccessStatusCode();
  
          Assert.Equal(HttpStatusCode.OK, response.StatusCode); 
      }
  }
  </code></pre>
  
  <p>How to make the tests use my current database ?</p>