I guess you mean, I should use Repeat.Once to the first call of
Return.
This doesn't work for me, as I am using MSpec and the first call to
Return is in the base class. Other test classes that derive from that
base class need Repeat.Any

BTW, my initial post had an error:
I am not calling Return a second time on the IMethodOptions instance
but WhenCalled(x=>x.ReturnValue = newValue);

On 29 Aug., 20:52, Ayende Rahien <[email protected]> wrote:
> Repeat.Once()
>
> On Sat, Aug 29, 2009 at 7:40 PM, DHilgarth <[email protected]> wrote:
>
> > Hi!
>
> > I started using Rhino.Mocks a few weeks ago and I am pretty happy with
> > it, it's a great time saver!
>
> > However, I have come across the need to change the return value of a
> > method stub.
> > There is a solution "out there" that involves calling BackToRecord
> > (...All) on the mock object. The problem with this is, that it also
> > seems to reset all events of the mocked object, losing all of its
> > subscribers...
> > That's actually pretty bad.
> > The only way around this is to not use BackToRecord, instead, I store
> > the IMethodOptions object returned by the call to Stub and call Return
> > on it. Every call to Return effectivly overrides the old return value.
> > The drawback is that I have to need this IMethodOptions object in the
> > first place.
> > It would be nice if two calls to Stub with the same parameters would
> > return the same IMethodOptions instance.
>
> > What do you think? Am I overseeing something?
>
> > Kind regards,
>
> > Daniel
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to