title: Rhino Mock: FailedRecorded expectation: IDateHelper.get_Now();
body: <p>I was debugging this nondescript Rhino Mocks error: </p>
  
  <blockquote>
    <p>Rhino.Mocks.Exceptions.ExpectationViolationException: ... Expected #0,
    Actual #1.</p>
  </blockquote>
  
  <p>Found that putting <code>RhinoMocks.Logger = new TextWriterExpectationLogger(Console.Out);</code> before the recording gave me more info: </p>
  
  <blockquote>
    <p>FailedRecorded expectation: IDateHelper.get_Now();</p>
  </blockquote>
  
  <p>But I have no idea how to fix this or even what is wrong.</p>
  
  <p>Code looks like this:</p>
  
  <pre><code>IDateHelper dateHelper = mock.StrictMock&lt;IDateHelper&gt;();
  DateTime now = new DateTime(2011, 12, 16);
  Expect.Call(dateHelper.Now).Return(now).Repeat.Any();
  ...
  public interface IDateHelper
      {
          DateTime Now { get; } 
      }
  </code></pre>
  
  <p>EDIT: Added the code that ledbutter asked for. I left out that dateHelper is being passed to another object, which is being passed to another object... I just didn't want to overwhelm you guys :) The code base I'm working with is huge and complex, and I didn't write it ;p</p>
  
  <pre><code>public IDateHelper DateHelper
      {
          get { return dateHelper ?? (dateHelper = new DateHelper()); }
          set { dateHelper = value; }
      }
  ...
  string date = Helper.ConvertDateToYearMonth(DateHelper.Now.AddMonths(1));
  </code></pre>
  
  <p>The ExpectationViolationException happens a few lines after this when the date variable gets passed to another function.</p>