title: Rhino Mocks Exception Expect #1 Actual #0 : Need assistance
body: <p>I've have searched on this and it seems to be a catch all, unfortunately everything I've read doesn't help figure it out.  Here is the class:</p>
  
  <pre><code>public interface IMockInterface
  {
      MockClass MockedMethod();
      MockClass MockThis();
  }
  
  public class MockClass : IMockInterface
  {
    public virtual MockClass MockedMethod()
    {
      MockClass returnValue;
  
      returnValue = new MockClass();
      returnValue.SomeMessage = "Not mocked";
      return returnValue;
    }
  
    public MockClass MockThis()
    {
      MockClass mock;
      MockClass returnValue;
  
      mock = new MockClass();
  
      return mock.MockedMethod();
    }
  }
  </code></pre>
  
  <p>And the test:</p>
  
  <pre><code>public void MockTest_Internal()
  {
    MockClass mainClass;
    MockClass returnedClass;
    IMockInterface mockProvider;
  
    mainClass = new MockClass();
  
    mockProvider = repository.StrictMock&lt;IMockInterface&gt;();
    Expect.Call(mockProvider.MockedMethod())
      .Return(new MockClass { SomeMessage = "Mocked" });
    repository.ReplayAll();
  
    returnedClass = mainClass.MockThis();
    provider.AssertWasCalled(item =&gt; item.MockedMethod());
  
    Assert.IsTrue(returnedClass.SomeMessage == "Mocked");
  }
  </code></pre>
  
  <p><strong>And have also tried and doesn't work</strong></p>
  
  <p>But I keep getting this exception:</p>
  
  <p>Rhino.Mocks.Exceptions.ExpectationViolationException:<br>
         IMockInterface.MockedMethod(); Expected #1, Actual #0</p>
  
  <p>Now from what I've read this would suggest either the method was called with different than expected parameters OR the method was never called but was expected to be called.  This isn't the case for the test.</p>
  
  <p>Side Note:  This is my first time really using Rhino.Mocks without some in house code so I am basically picking it up as I go.  There could be something really stupid here...</p>
  
  <p><strong>This was the old test commented on, but is not what I should have been using:</strong></p>
  
  <pre><code>public void MockTest_Internal()
  {
    MockClass mainClass;
    MockClass returnedClass;
    IMockInterface mockProvider;
  
    mainClass = new MockClass();
  
    var provider = MockRepository.GenerateStub&lt;IMockInterface&gt;();
    provider.Stub(item =&gt; item.MockedMethod())
      .Return(new MockClass { SomeMessage = "Mocked" });
  
    returnedClass = mainClass.MockThis();
    provider.AssertWasCalled(item =&gt; item.MockedMethod());
  
    Assert.IsTrue(returnedClass.SomeMessage == "Mocked");
  }
  </code></pre>