Interesting. What if I have an overloaded method takes a Bus?

void f(Bus b);

And I want to make sure impl.f(new Bus()) didn't call the Vehicle
overload. I can do this with a cast.

impl.AssertWasNotCalled(x=>x.f((Vehicle)Arg<Bus>.Is.TypeOf));

But it would be easier to understand.

impl.AssertWasNotCalled(x=>x.f(Arg<Vehicle>.Is.TypeOf<Bus>());

Cheers,
Kenneth

On Tue, Sep 15, 2009 at 9:16 AM, Timores <[email protected]> wrote:
>
> I got enlightened while writing a reply...
>
> Assume I have a method f in some interface I:
>
> void f(Vehicle V);
>
> After creating a mock for the interface, I want to describe the
> expectation of the f method.
>
> I impl = mock.StrictMock<I>();
>
> I don't see any value in using Expect on f  with a type argument of
> Vehicle, i.e.
>
> impl.Expect ( x => x. f ( Arg<Vehicle>.Is.TypeOf) );
>
> The compiler will only accept a Vehicle to be passed to f, a Human or
> int or double will not do.
>
> But if I have Car as a subclass of Vehicle, the following could be
> interesting:
>
> impl.Expect ( x => x.f (Arg.Is.TypeOf<Car>) );
>
> (The enlightenment came while writing the previous line)
>
> What I want is doable like this:
>
> impl.Expect (x => x.f (Arg<Car>.Is.TypeOf ));
>
> and works fine.
>
> So, please forget about my request. The current state is quite fine.
> Thank you all for trying to show it to me.
>
> Jean-Marie
>

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