How can I replace an already declared stub call with a different stub call?

I use this extension method to clear the behavior of stubs (or the behavior+expectations of mocks):

public static class RhinoExtensions
{
    /// <summary>
    /// Clears the behavior already recorded in a Rhino Mocks stub.
    /// </summary>
    public static void ClearBehavior<T>(this T stub)
    {
        stub.BackToRecord(BackToRecordOptions.All);
        stub.Replay();
    }
}

I picked that up from this other stackoverflow answer, or maybe it was this one.


I use the Repeat.Once() or Repeat.Times(x) methods where it will move on the next stub\expectation when the limit has been reached.

Tags:

C#

Rhino Mocks