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

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