title: How to implement IClassFixture hierarchy in xunit.net
body: <p>In xunit.net I'm trying to utilize the same <code>ConfigFixture</code> in both  <code>LogFixture</code> and <code>DbFixture</code>, but to no avail.</p>
  <p>Why I'm trying to do this is because I'd like to utilize the same configuration fixture in other fixtures so I can keep class concerns separated, i.e bringing in the config fixture as a building block where needed.</p>
  <p>Example:</p>
  <pre><code>public class Test : IClassFixture&lt;DbFixture&gt;
  {
      public Test(DbFixture db)
      {
      }
  
      [Fact]
      public void MyTest()
      {
          Assert.True(true);
      }
  }
  
  public class DbFixture : IClassFixture&lt;LogFixture&gt;, IClassFixture&lt;ConfigFixture&gt;
  {
      public DbFixture(LogFixture log, ConfigFixture conf)
      {
          SetupDbConnection(conf.ConnectionString);
          SetupEfLogging(log);
      }
  }
  
  public class LogFixture : IClassFixture&lt;ConfigFixture&gt;
  {
      public LogFixture(ConfigFixture conf)
      {
          if (conf.IsLoggingEnabled)
              SetupXunitLogging();
      }
  }
  
  public class ConfigFixture
  {
      public string ConnectionString =&gt; Configuration.GetConnectionString(&quot;MyDb&quot;);
      public bool IsLoggingEnabled =&gt; Configuration.GetValue&lt;bool&gt;(&quot;EnableLogging&quot;);
  }
  </code></pre>
  <p>Running this code throws this error</p>
  <blockquote>
  <p>System.AggregateException : One or more errors occurred. (Class fixture type 'MyTests.TestFixtureA' had one or more unresolved constructor arguments: TestFixtureB b, TestFixtureC c) (The following constructor parameters did not have matching fixture data: TestFixtureA a)
  ---- Class fixture type 'MyTests.TestFixtureA' had one or more unresolved constructor arguments: TestFixtureB b, TestFixtureC c
  ---- The following constructor parameters did not have matching fixture data: TestFixtureA a</p>
  <p>----- Inner Stack Trace #1 (Xunit.Sdk.TestClassException) -----</p>
  <p>----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----</p>
  </blockquote>
  <p>How should I setup this to make it work?</p>