title: Why is a method called from the Expect() statement?
body: <p>I am trying to set an expectation on a Mocked object to find out if the method was called as expected.</p>
  
  <p>I use the following code to achieve it.</p>
  
  <pre><code>//// Create a mocked object(arrange)
  A controller = MockRepository.GenerateMock&lt;A&gt;();
  someObject.Stub(x =&gt; x.Resolve(typeof(A))).Return(controller);
  
  //// Act i.e. call the target function where the controller is created
  this._target.InvokePrivateMethod("OnTargetUpdated", false, this, eventArgs);
  
  //// Assert
  controller.AssertWasCalled(x =&gt; x.UpdateTarget(targetInfo2), o =&gt; o.Repeat.Once());
  </code></pre>
  
  <p>However, when i try to assert if the "UpdateTarget()" was called the flow goes into the code of the method. I simply want to check "If the method was called" and not "call the method".</p>