title: How to set up the DbContext in xUnit test project properly?
body: <p>I have the following code to set up DBContext in the .Net core 2.0 console program and it's injected to the constructor of the main application class.</p>
  
  <pre><code>    IConfigurationRoot configuration = GetConfiguration();
      services.AddSingleton(configuration);
      Conn = configuration.GetConnectionString("ConnStr1");
  
      services.AddDbContext&lt;MyDbContext&gt;(o =&gt; o.UseSqlServer(Conn));
  </code></pre>
  
  <p>Now I created a xUnit test class and need to initialize the same DbContext for testing.</p>
  
  <pre><code>    context = new MyDbContext(new DbContextOptions&lt;MyDbContext&gt;());
  </code></pre>
  
  <p>It gets the error of the parameter <code>connectionString</code> cannot be null. How to set up the DbContext in test project properly? </p>