I guess this is some sort of state v.s. interactive test. I had the
same need for this.
Yes, there is a logic to determine which is called but this is
implementation detail. If my email service as overloaded sendmail
methods. All I care is one of them is called. Which one is called is
the implementation detail and I don't want my test case to fail if the
implementation changes in future.
There is no direct support from RhinoMocks for this but you can do
below to archive the same result:
try {
mock.AssertWasCalled(x=>x.B(i));
} catch (FogotNameButYouCanFindOutEasilyException)
{
try {
mock.AssertWasCalled(x=>x.B(i,j));
} catch (...) {
mock.AssertWasCalled(x=>x.B(i,j,k));
}
}
On Tue, Jul 7, 2009 at 12:52 PM, Tim Barcz<[email protected]> wrote:
> What is the usage of this....?
>
> The code isn't random as runtime is it? There is logic in place to
> determine what actual method should be called. If that is the case you can
> assert the different scenarios.
>
> Tim
>
> On Mon, Jul 6, 2009 at 8:29 PM, Al <[email protected]> wrote:
>>
>> Hi,
>>
>> I have a question you might help me with.
>> We need to verify that a method A calls any of the overloaded forms of
>> method B.
>>
>> e.g. I have
>> void B(int)
>> void B(int, int)
>> void B(int, int, int)
>>
>> and I don't care which one of those is called from my method A (at
>> least one must be called).
>> Is it possible with Rhino Mocks to define "alternative
>> expectations" ? Like a set of expectation from which at least one
>> must be met (or something like .VerifyAnyExpectation instead
>> of .VerifyAllExpectations) ?
>>
>> If this is not possible, what would you suggest for this scenario?
>>
>> What I did now is grouped the 3 methods in the most complex one.
>> The call B(x) will now be B(x, null, null), but I don't like this work-
>> around and I'm looking for better alternatives.
>>
>> Thanks,
>> Al
>>
>>
>>
>>
>>
>
>
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---