I had a blog post at one point written about this and trhew it out because I
figured no one would be interested.

I can safely say there would've been at least one person interested.

Tim

On Wed, Jul 29, 2009 at 5:22 PM, Ayende Rahien <[email protected]> wrote:

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


-- 
Tim Barcz
ASPInsider
http://timbarcz.devlicio.us
http://www.twitter.com/timbarcz

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