title: When using Moq Verify() method invocation count, have failing test's error message contain actual method invocation count using Moq
body: <p>
  Consider the following, where I am testing that an injected dependency's method is called a specific number of times:</p>
  
  <pre class="lang-cs prettyprint-override"><code>[Fact]
  public void WhenBossTalksEmployeeBlinksTwice()
  {
      // arrange
      var employee = new Mock&lt;IEmployee&gt;();
      employee.Setup(e =&gt; e.Blink());
  
      var boss = new Boss(employee.Object);
  
      // act
      boss.Talk();
  
      // assert
      employee.Verify(e =&gt; e.Blink(), Times.Exactly(2)); // Passes as expected
      employee.Verify(e =&gt; e.Blink(), Times.Exactly(1)); // Fails as expected
  }
  </code></pre>
  
  <p>When I force the failing test, the output is:</p>
  
  <blockquote>
    <p>Moq.MockException: Invocation was not performed on the mock 1 times: e
    => e.Blink()</p>
  </blockquote>
  
  <p>What would be better is something like:</p>
  
  <blockquote>
    <p>Moq.MockException: Invocation was unexpectedly performed 2 times, not 1 time: e
    => e.Blink()</p>
  </blockquote>
  
  <p>Here are the items involved with the test:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public interface IEmployee { void Blink(); }
  
  public class Boss {
      private readonly IEmployee _employee;
      public Boss(IEmployee employee) { _employee = employee; }
  
      public void Talk() {
          _employee.Blink();
          _employee.Blink();
      }
  }
  </code></pre>
  
  <p><strong>Is it possible to harvest and display the actual number of times the dependency's method was called, in the failing test's error message?</strong></p>
  
  <p>I'm not sure that it matters, but I'm using Moq v3.1.416.3 (not the latest, I know, but another library I'm using hasn't updated to Moq 4.x yet…)</p>