title: When does a mock object enter the replay state?
body: <p>When executing the second line of this code Rhino Mocks throws an InvalidOperationException with a message "This action is invalid when the mock object is in replay state"  </p>
  
  <pre><code>var mockScanner = MockRepository.GenerateMock&lt;PortScanner&gt;(null);
          mockScanner.Expect((scanner =&gt; { scanner.Scan(null, null); }));
  </code></pre>
  
  <p>Stepping through the code in a debugger one can see the debugger run the method defined in the class and directly after control leaves this method the exception occurs.  </p>
  
  <p>This similar code in  another test does work without issue</p>
  
  <pre><code>var mockView = MockRepository.GenerateMock&lt;IScanView&gt;(null);
          mockView.Expect(view =&gt; { view.Close(); });
          var controller = new ScanController(mockView);
          controller.Exit();
          mockView.VerifyAllExpectations();
  </code></pre>
  
  <p>The only difference that I can think of that might be of any consequense between theese two tests is that Exit is a member on an interface while Scan is a virtual member on a class</p>
  
  <p>What am I missing?</p>
  
  <p><strong><em>Update</em></strong><br>
  Further exploration has indicated that this is related to the way Rhino handles virtual methods. I am focusing mmy study of the documentation here now</p>