Hmmm. Interesting point...
What if the parameters you were given (a,b,c,d) were of the correct
types for each argument, but as an object from "Arg<T>.Is" so that you
could have something like:

mockViewEngine.Stub((a,b,c,d)=>mockViewEngine.FindView
(a.Anything,b.Null,c.EqualTo(2),d.Anything)).Return(...);

I'm not sure if you could do that and take advantage of the
intelligence of detecting return types etc.
Just something cool to ponder.

... another thought:
How about something like:
mockViewEngine.Stub(()=>
mockViewEngine.FindView ).IgnoreArguments.Return(...);

Seems easier to read. hmmm.... :)

On Sep 25, 9:09 am, Krzysztof Koźmic (2) <[email protected]> wrote:
> I don't remember the exact syntax, but I once saw something like this:
>
> mockViewEngine.Stub((a,b,c,d)=>mockViewEngine.FindView(a,b,c,d)).Return
> (...);
>
> basically, if you want to ignore argument, you pass it as expression'
> delegate argument,
> if you wanted to not ignore a certain one, like - you want to expect
> 3rd one to be "foo", you'd do:
>
> mockViewEngine.Stub((a,b,c)=>mockViewEngine.FindView
> (a,b,"foo",c)).Return(...);
>
> This would however lead to overload explosion, as you'd have to
> accommodate for 0-many generic arguments, plus I don't know had this
> would work in more complicated scenarios.
>
> On 24 Wrz, 15:49, Tim Barcz <[email protected]> wrote:
>
> > Curious about people's preference.  Which would you prefer to a) read b)
> > write ?
>
> >    1. mockViewEngine.Stub(x =>
> >    x.FindView(Arg<ControllerContext>.Is.Anything, Arg<string>.Is.Anything,
> >    Arg<string>.Is.Anything, Arg<bool>.Is.Anything)).Return(...);
> >    2. mockViewEngine.Stub(x => x.FindView(null,
> >    null,null,false)).IgnoreArguments().Return()
>
> > --
> > Tim Barcz
> > Microsoft 
> > ASPInsiderhttp://timbarcz.devlicio.ushttp://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to