Hi Patrick,

That didn't work for me but for some reason this does:

            myMock.Stub(e => e.MyMethod(Arg<string>.Is.Anything,
Arg<int>.Is.Anything))
                .Return(null)
                .WhenCalled(a => a.ReturnValue =
MyMethodLocalImplementation((string)a.Arguments[0],
(int)a.Arguments[1]));

As a Moq fanboi I find this pretty clunky :/

On Sep 21, 1:58 pm, Patrick Steele <[email protected]> wrote:
> Use "WhenCalled".
>
> myMock.Stub(x => x.SomeMethod()).WhenCalled(i => ...);
>
> IIRC, the lambda parameter "i" is a "MethodInvocation" that gives you
> access to the method's arguments as well as setting a return value.
>
> ---
> Patrick Steelehttp://weblogs.asp.net/psteele
>
>
>
>
>
>
>
> On Wed, Sep 21, 2011 at 8:31 AM, Felix <[email protected]> wrote:
> > Hi,
>
> > using Moq I would do this:
>
> >            myMock.Setup(x => x.MyMethod(It.IsAny<string>(),
> > It.IsAny<int>())).Returns(
> >               (string str, int num) =>
> > MyMethodLocalImplementation(str, num));
>
> > to implement one method of my stub locally. How can this be done in
> > Rhino?
>
> > Thanks for any help.
> > felix
>
> > --
> > 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 
> > athttp://groups.google.com/group/rhinomocks?hl=en.

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