Try to use Callback instead of return, or maybe consider to write fake impl for 
complex setup. 
HTH
Kenneth
Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: jsearles <[email protected]>

Date: Wed, 29 Jul 2009 14:54:59 
To: Rhino.Mocks<[email protected]>
Subject: [RhinoMocks] Rhino Mocks caches return values



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