title: How to setup AutoFixture.AutoMoq to moq all contructor parameters?
body: <p>I am using AutoFixture to mock an external library that doesn't always implement interfaces, but has a default ctor without parameters.</p>
  
  <p>Currently, I am using Moq/AutoMoq framework like that:</p>
  
  <pre><code>mocker.GetMock&lt;HeavyDependency&gt;()
        .Setup(x =&gt; x.GetData())
        .Returns("TEST DATA");
  </code></pre>
  
  <p>I want to have the same behaviour with AutoFixture.AutoMoq. My code:</p>
  
  <pre><code>namespace AutoFixtureNUnit.TestsCs
  {
      public class HeavyDependency1
      {
          public HeavyDependency1() =&gt; Debug.WriteLine("HeavyDependency1");
      }
      public class HeavyDependency2
      {
          public HeavyDependency2() =&gt; Debug.WriteLine("HeavyDependency2");
      }
  
      public class MyClassWithHeavyDependency
      {
          private readonly HeavyDependency1 dep1;
          private readonly HeavyDependency2 dep2;
  
          public MyClassWithHeavyDependency() =&gt; Debug.WriteLine("MyClassWithHeavyDependency default.");
          public MyClassWithHeavyDependency(HeavyDependency1 h1, HeavyDependency2 h2)
          {
              Debug.WriteLine("MyClassWithHeavyDependency injected.");
              dep1 = h1;
              dep2 = h2;
          }
      }
  
      [TestFixture]
      public class TestClass
      {
          private Fixture _fixture;
          private Mock&lt;HeavyDependency1&gt; _heavyMock;
          MyClassWithHeavyDependency _sut;
  
          [SetUp]
          public void SetUp()
          {
              _fixture = new Fixture();
  
              _fixture
                  .Customize(new ConstructorCustomization(typeof(MyClassWithHeavyDependency), new GreedyConstructorQuery()))
                  .Customize(new AutoMoqCustomization(){ConfigureMembers = false});
  
              _heavyMock = new Mock&lt;HeavyDependency1&gt;();
              _fixture.Inject(_heavyMock.Object);
  
              _sut = _fixture.Create&lt;MyClassWithHeavyDependency&gt;();
          }
  
          [Test]
          public void TestMethod()
          {
              Assert.Pass("Your first passing test");
          }
      }
  }
  </code></pre>
  
  <p><code>MyClassWithHeavyDependency</code> has a ctor that takes dependent objects and code above calls that ctor.</p>
  
  <p>So far so good. I am injecting the Mock of the dependent object and verifying calls.</p>
  
  <p><strong>The problem:</strong></p>
  
  <p>For the mocks that are Injected, the constructor is called with the Mock like: <code>{Mock&lt;AutoFixtureNUnit.TestsCs.HeavyDependency1:00000001&gt;.Object}</code>. </p>
  
  <p>However, for all other types it is called with the parameter of <code>{AutoFixtureNUnit.TestsCs.HeavyDependency2}</code>. Which is not what I want and is not used by the current tests. Not a Moq object, right?</p>
  
  <p>It is mocking my own interfaces as well.</p>
  
  <p><strong>Question:</strong></p>
  
  <p>Can I somehow specify that AutoFixture.AutoMoq should mock all ctor parameters that are not manually mocked by me?</p>
  
  <p>Because Freezing/injecting every single one is not different from manual mock setup and requires a lot of code changes every time I add ctor parameter.</p>
  
  <p>Actually, I can see <code>HeavyDependency1</code> ctor called as well. Seems strange.</p>