public class Request
 {
      public virtual string ExecuteRequest() { ... }
 }

public class Translator
 {
     public virtual List<Result> Translate(String xml) { ... }
}

// NOTE: this is the class where the expectation is ignored
public class Renderer
{
    public virtual string RenderToHtml() { ... }
}

On Fri, Nov 25, 2011 at 9:19 AM, Patrick Steele <[email protected]>wrote:

> Can you also show the signatures of the various methods you're mocking?
>
> ---
> Patrick Steele
> http://weblogs.asp.net/psteele
>
>
>
> On Wed, Nov 23, 2011 at 12:25 PM, Steven Solomon
> <[email protected]> wrote:
> > Hi all,
> >
> > I am trying to test that a manager class with call its collaborators
> > when i call GetRecommendations on it
> > however the mockRender expectation is ignored? I am trying to test
> > that the renderer will be called
> > with an empty list of results. Any insight into this is greatly
> > appreciated.
> >
> > var mocks = new MockRepository();
> >
> > var mockRequest = mocks.StrictMock<Request>("somequery");
> > var mockTranslator = mocks.StrictMock<Translator>();
> > var mockRenderer = mocks.StrictMock<Renderer>();
> >
> > Expect.Call(mockRequest.ExecuteRequest()).Return("xml");
> > Expect.Call(mockTranslator.Translate("xml"));
> > // we are expecting an empty list of results
> > mockRenderer.Expect(x =>
> >        x.RenderToHtml(Arg<List<Result>>.Matches(y =>
> >                y.Equals(new List<Result>())
> >        ))
> > );
> >
> > mocks.ReplayAll();
> >
> > // SUT
> > Manager manager = new Manager(mockRequest, mockTranslator,
> > mockRenderer);
> > manager.GetRecommendations();
> >
> > mocks.VerifyAll();
> >
> > --
> > 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.
>
>

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