Hi Tim

Thanks for your answer :)
It actually makes a lot of sense.
--
Dom

On Aug 20, 2:04 pm, Tim Barcz <[email protected]> wrote:
> Try changing you assertion to:
> view.AssertWasCalled(v=>v.SendToPrinter += Arg<EventHandler>.Is.Anything);
>
> LastCall.IgnoreArguments works in Replay mode but in AAA you're asserting
> then trying to change the assertion after the fact.
>
>
>
> On Thu, Aug 20, 2009 at 4:22 AM, DomRibaut <[email protected]> wrote:
>
> > Hi,
> > (I am new to Rhino-mocks so please correct me i usage is wrong)
>
> > I want to test registration of a presenter to an event of a view. I am
> > using MSpec and the AAA-syntax reads much better. Could you point me
> > to what I am doing wrong and how to achieve my goal.
> > First snippet demonstrate the kind of code I would like to write. The
> > second snippet is an a test that actually works (with replay).
>
> > What I tried without luck (AAA)
> > public class Testing_with_AAA
> >        : PrintingContext
> >    {
> >        Establish context = () =>
> >        {
> >            view = MockRepository.GenerateMock<IDocumentsView>();
> >            user = testMother.TestUser;
> >            orders = new List<Orders>();
> >        };
> >        Because of = () =>
> >        {
> >            presenter = new DocumentsPresenter(view, user, orders);
> >        };
>
> >        It rocks = () =>
> >        {
> >            view.AssertWasCalled(v => v.SendToPrinter += null);
> >            LastCall.IgnoreArguments();
> >        };
> >    }
>
> > It works well with the replay syntax
> >  public class Testing_with_replay
> >        : PrintingContext
> >    {
> >        Establish context = () =>
> >        {
> >            mock = new MockRepository();
> >            view = mock.DynamicMock<IDocumentsView>();
> >            view.SendToPrinter += null;
> >            LastCall.IgnoreArguments();
> >            mock.ReplayAll();
>
> >            user = testMother.TestUser;
> >            orders = new List<Orders>();
> >        };
> >        Because of = () =>
> >        {
> >            presenter = new DocumentsPresenter(view, user, orders);
> >        };
>
> >        It is_for_grown_up = () => mock.VerifyAll();
> >    }
>
> > --
> > Dom
>
> --
> Tim Barcz
> 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