title: Moq No invocations performed
body: <p>My unit test gives me </p>
  
  <blockquote>
    <p>"Configured setups:  x => x.GetCount(It.IsAny(),
    It.IsAny()) No invocations performed."</p>
  </blockquote>
  
  <p>This is the method below:</p>
  
  <pre><code>private IService Client = null;
  public void CountChecks()
  {
     Client = new ServiceClient();
     var _amount = Client.GetCount(value01, value01);
  }
  </code></pre>
  
  <p>This is my test class:</p>
  
  <pre><code>public class CountChecksClassTests
  {
     private Mock&lt;IService &gt; service { get; set; }
     private CountChecksClass { get; set; }
  
     [TestInitialize]
     public void Setup()
     {
        service = new Mock&lt;IService&gt;();
        service.Setup(x =&gt; x.GetCount(It.IsAny&lt;DateTime&gt;(), It.IsAny&lt;DateTime&gt;()));
  
        checker = new CountChecksClass ();            
     }
  
     [TestMethod()]
     public void GetCountTest()
     {
        checker.CountChecks();
        service.Verify(x =&gt; x.GetCount(It.IsAny&lt;DateTime&gt;(), It.IsAny&lt;DateTime&gt;()));
     }
  }
  </code></pre>
  
  <p>When I debug the test, the method gets called. So, why am I getting a No invocations performed error? The error occurs at <code>service.Verify(x =&gt; x.GetCount(It.IsAny&lt;DateTime&gt;(), It.IsAny&lt;DateTime&gt;()));</code></p>