title: Can Moq return the real object instance passed into a Setup method called on a Mock with a void return type?
body: <p>I have a call as such:</p>
  
  <pre><code>_session.Setup(session =&gt; session.SaveOrUpdate(It.IsAny&lt;Foo&gt;()))
  </code></pre>
  
  <p>I want to retrieve a copy of whatever instance of <code>Foo</code> is passed into <code>SaveOrUpdate</code> when the test is run for validation.  How can I get a copy of that exact <code>Foo</code> into my test?</p>
  
  <p>I tried to use <code>.Callback</code>, but maybe that is not the way to do this?  Or maybe I'm doing it wrong... not sure, but I could use some assistance trying to figure out if this is possible and how to do this please.</p>
  
  <pre><code>Foo foo;
  
  _session.Setup(session =&gt; session.SaveOrUpdate(It.IsAny&lt;Foo&gt;()))
          .Callback&lt;Foo&gt;(fooInstanceBeingSaved =&gt; foo = fooInstanceBeingSaved as Foo);
  </code></pre>
  
  <p>In this scenario, <code>foo</code> is always returned <code>null</code>, even though the real <code>foo</code> in the service layer is populated.</p>
  
  <p>EDIT:
  This is not a duplicate of said duplicate because this question differs in that SaveOrUpdate returns void.  In the reportedly duplicate articles, those methods return something other than void.  As such, I need to get the variable out of a method where "Returns" is not a valid option - which is the solution in the other articles.</p>