title: How to use XUnit Dependency Constructor Injection to create my concrete classes
body: <p>I nuget the xunit.DependencyInjection package and created my construction with my interfaces.   The test case compiles but when I run xunits it does not execute my constructor dependency injection.</p>
  <pre><code> public class TestSuite{
    IARepository _aRepository;
    IBRepository _bRepository;
      public TestSuite(IARepository aRepository, IBRepository bRepository)
      {
          _aRepository = aRepository;
          _bRepository = bRepository;
      }
  }
  </code></pre>
  <p>The GitHub suggests that constructor injection is possible:
  <a href="https://github.com/pengweiqhca/Xunit.DependencyInjection/tree/master/Xunit.DependencyInjection.Test" rel="nofollow noreferrer">https://github.com/pengweiqhca/Xunit.DependencyInjection/tree/master/Xunit.DependencyInjection.Test</a></p>
  <p>Startup.cs</p>
  <pre><code> public class Startup
   {
      public void ConfigureServices(IServiceCollection services)
      {
  
      var configuration = new ConfigurationBuilder()
              .SetBasePath(System.IO.Directory.GetCurrentDirectory())
              .AddJsonFile(&quot;appsettings.json&quot;, false, true)
              .Build();
  
                      
          var connectionString =     configuration.GetConnectionString(&quot;A_DbCoreConnectionString&quot;);
          services.AddDbContext&lt;AContext&gt;(options1 =&gt; options1.UseSqlServer(connectionString));
  
          connectionString= configuration.GetConnectionString(&quot;B_DbCoreConnectionString&quot;);
          services.AddDbContext&lt;BContext&gt;(options2 =&gt; options2.UseSqlServer(connectionString));
  
          services.AddTransient&lt;IARepository, ARepository&gt;();
          services.AddTransient&lt;IBRepository, BRepository&gt;();
      }
    }
  </code></pre>
  <p>A and B Repository.cs</p>
  <pre><code>public class ARepository :IARepository
  {
      public AContext _dbContext; 
      public ARepository(AContext dbContext) 
      {
          _dbContext = dbContext;
      }
      ...
  }
  
  public class BRepository :IBRepository
  {
      public BContext _dbContext; 
      public BRepository(BContext dbContext) 
      {
          _dbContext = dbContext;
      }
      ...
  }
  </code></pre>