title: MOQ Mock void method that changes a field value
body: <p>I am new to MOQ and Mocking.<br>
  Assume I have a class like this, with a void method that changes a value:  </p>
  
  <pre><code>public class Sample
  {
      public virtual int Number { get; set; }
  
      public virtual void Check(int a)
      {
          this.Number = a &gt; 10 ? this.Number = 100 : this.Number = 200;
      }
  }
  </code></pre>
  
  <p>I want to test the void method to make sure it is changing the local field <code>Number</code>.</p>
  
  <pre><code>[Fact]
  public void TestSampleClass()
  {
      var sut = new Mock&lt;Sample&gt;();
      sut.Setup(s =&gt; s.Number).Returns(50);           
  
      sut.Setup(s =&gt; s.Check(It.IsAny&lt;int&gt;())).Callback(
          (int testNumber) =&gt;
          {
              if (testNumber &gt; 10)
              {
                  sut.Setup(s =&gt; s.Number).Returns(100);
              }
              else
              {
                  sut.Setup(s =&gt; s.Number).Returns(200);
              }                   
          });
  }
  </code></pre>
  
  <p>It seems that the method doesn't change the value to 100 or 200... 
  If I print <code>sut.Object.Number</code> it gives the initial value, not the updated one after void call.</p>