title: How to Mock Entity Framework Core Change Tracking
body: <p>I have a Mocked Context Setup like this.</p>
  
  <pre><code>// Creates a working Fake Db Set of FakeClass Type
  var fakeDbSet = Mockings.CreateDbSetMock(fakeData);  
  var fakeContext = new Mock&lt;FakeContext&gt;();  
  fakeContext.Setup(c =&gt; c.FakeData).Returns(fakeDbSet);     
  </code></pre>
  
  <p>Access to the Context itself an the FakeData works as intended.
  But now I'm trying to write a Unit Test for a function which accesses the ChangeTracker of fakeContext.</p>
  
  <pre><code>ctx.ChangeTracker.AutoDetectChangesEnabled = false;  
  </code></pre>
  
  <p>Now the test fails and an Exception is thrown, because accessing the ChangeTracker of the mocked context returns null.</p>
  
  <p>Is there a way to mock the ChangeTracker of the Context?</p>
  
  <p>I already tried to setup the mocked Context with a mocked ChangeTracker, but I can't create a valid Instance, because it requieres the Context itself in the Constructor.</p>