#2 Coping with lookup functions

open
nobody
None
5
2005-04-20
2005-04-20
Bob
No

We have a lookup function that returns a unique value
for a unique key. The order of the calls on this
function is not relevant to the class under test - it
is an implementation detail.

What is needed is some support for this. Possible
solutions include:
A) Allow custom code to be executed when mock method is
called. This allows for semi-dynamic mocks.
B) Provide IfCalledThenResult, which works like
ExpectAndReturn, but sets up a mapping function such
that if the method is called with these arguments, then
return the given result.

I'm just providing these solution suggestions only as a
way to illustrate the problem.

Discussion