Try WhenCalled

On Thu, Jul 30, 2009 at 12:54 AM, jsearles <[email protected]> wrote:

>
> I notice that when returning a value from mock, that value is cached.
> For example, the following always return the same value:
>
> mock.Expect(m => m.Current).Return(DateTime.Now).Repeat.Any();
>
> This makes sense - you're returning a value, not an invocation. I can
> get around this by explicitly setting the expected value before each
> expected call to it, but this is a hassle as well as error prone. Is
> there a way to cause the return value to invoke a method to retrieve a
> value on each call. I'm imagining something like:
>
> mock.Expect(m => m.Current).Return(() => DateTime.Now);
>
> Thanks!
>
> Josh
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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