title: Mock.Verify uses current value of list, not the value of the list when the method being verified was called
body: <p>I have a situation where I'm running a unit test and calling <code>Verify</code> to assert that a method was called using a non-empty list as a parameter.  The method being tested calls <code>Clear()</code> on the list at the end of the method.  It seems like when <code>Verify</code> is called, it's checking the state of the list at the current time, not at the time when my function was called.  Is that the expected behavior and is there any way to have <code>Verify</code> use the value of the list at the time that my method was called?</p>
  <pre><code>using Microsoft.VisualStudio.TestTools.UnitTesting;
  using Moq;
  using System.Linq;
  using System.Collections.Generic;
  
  namespace Tests
  {
      [TestClass]
      public class UnitTest1
      {
          public interface IMyDependency
          {
              void ParseNumbers(List&lt;int&gt; numbers);
          }
  
          public class MyDependency : IMyDependency
          {
              public void ParseNumbers(List&lt;int&gt; numbers)
              {
              }
          }
  
          public class SystemUnderTest
          {
              private IMyDependency myDependency;
  
              public SystemUnderTest(IMyDependency myDependency)
              {
                  this.myDependency = myDependency;
              }
  
              public void DoSomething(List&lt;int&gt; numbers)
              {
                  this.myDependency.ParseNumbers(numbers);
  
                  // This causes my test to fail because Verify thinks that ParseNumbers was called
                  // with an empty list as the parameter, even though the list was not empty when
                  // ParseNumbers was called
                  numbers.Clear();
              }
          }
  
          [TestMethod]
          public void TestMethod1()
          {
              var myDependency = new Mock&lt;IMyDependency&gt;();
              var systemUnderTest = new SystemUnderTest(myDependency.Object);
  
              systemUnderTest.DoSomething(new List&lt;int&gt; { 1, 2, 3 });
  
              // This succeeds
              myDependency.Verify(e =&gt; e.ParseNumbers(It.IsAny&lt;List&lt;int&gt;&gt;()), Times.Once);
          
              // This fails
              myDependency.Verify(e =&gt; e.ParseNumbers(It.Is&lt;List&lt;int&gt;&gt;(m =&gt; m.Count &gt; 0)), Times.Once);
          }
      }
  }
  </code></pre>