Surely you want

T TypeOf<T>

and not

U TypeOf<T>

The first one says "when I say give me an object of type T I expect to
be given an object of type T."
The second one says "when I say give me an object of type T, I expect
to be given an objecct of type U"

I know which one makes sense to me.


Or have I missed something?

On Sep 14, 12:41 pm, Timores <[email protected]> wrote:
> Hi,
> In RhinoMocks 3.6 there is the TypeOf property in Arg<T>. It checks
> that the argument is really of type T. I am new to mocks, so I am a
> bit hesitant to ask if this is really useful. The compiler will not
> let us pass anything else than a T as the argument.
>
> What I'd like instead is what I think is in the docs, i.e. a TypeOf<U>
> property, like this:
>
> public T TypeOf<U>
>     : where U : T
>                 {
>                         get
>                         {
>                                 ArgManager.AddInArgument(Is.TypeOf<U>());
>                                 return default(T);
>                         }
>                 }
>
> When a method accepts an abstract class as a parameter, it is useful
> in a unit test to check that an argument is of a more derived type.
>
> What do you think ?
>
> Regards,
> 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