Try this

            var fooService = MockRepository.GenerateStub<IFooService>();

*            fooService.Stub(s =>
s.GetDescription(Arg<Foo>.Is.Anything)).WhenCalled(*
*                (i) => i.ReturnValue = i.Arguments.First());*

            var testMe = new TestMe(fooService);

On 16 May 2011 13:44, Giulio Petrucci <[email protected]> wrote:

> Hi there,
>
> here is my scenario:
>
> class Foo {
>    String Label { get; }
> }
>
> interface IFooService
> {
>    string GetDescription(Foo foo);
> }
>
> class TestMe
> {
>    public TestMe(IFooService fooService) { ... }
> }
>
> In my test code I have:
>
> var fooService = MockRepository.GenerateStub<IFooService>();
> var testMe = new TestMe(fooService);
>
> and I'd like that when the GetDescription() stubbed method is invoked,
> the returned value is its argument Foo.Label value. How can I do that?
>
> Thanks,
> Giulio
>
>
> --
>
> --
> 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.
>
>

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