I found the problem. The call to the Presenter contructor has to be
after the call to ReplayAll.
It is the error message that was throwing me a bit as it seemed to
suggest that an expectiation had been set up when it hadn't explicitly
been set.

On May 21, 5:52 pm, Patrick Steele <[email protected]> wrote:
> What is the presenter doing with the IMTLCampaignView?  Does it hook
> up any event handlers in the ctor or during the call to
> ProcessNQTWizardStep?
>
> ---
> Patrick Steelehttp://weblogs.asp.net/psteele
>
>
>
>
>
> On Fri, May 21, 2010 at 10:07 AM, DomsRoberts <[email protected]> wrote:
> > Here is the Test. IMTLCampaignView is an interface that also
> > incorporates IView and when the test runs all goes through but gets
> > the message I posted earlier.
> > NMoq works fine with it but not RhinoMocks
>
> >  public void ProcessNQTWizardStepNQTTest()
> >        {
> >            MockRepository mocker = new MockRepository();
> >            IMTLCampaignView view =
> > mocker.DynamicMock<IMTLCampaignView>();
>
> >            MTLPresenter presenter = new MTLPresenter(view);
>
> > Expect.Call(view.GetViewStateValue(MTLPresenter.EmailResponseKey)).Return(f­alse);
>
> >            mocker.ReplayAll();
>
> >            string nextStep = presenter.ProcessNQTWizardStep("nqt",
> > false);
>
> >            Assert.AreEqual(string.Empty, nextStep);
>
> >            mocker.VerifyAll();
> >        }
>
> > On May 21, 2:32 pm, Patrick Steele <[email protected]> wrote:
> >> Could you show us your test code too?  I'm not clear on exactly what
> >> you want to test and what you're expecting.
>
> >> ---
> >> Patrick Steelehttp://weblogs.asp.net/psteele
>
> >> On Fri, May 21, 2010 at 6:26 AM, DomsRoberts <[email protected]> 
> >> wrote:
> >> > I should add that I have tried adding view.Load += null; etc. But to
> >> > no avail.
>
> >> > The error result I get is
>
> >> > TestCase
> >> > 'M:Tda.Tests.MTL.MTLCampaignPresenterTests.ProcessEmploymentStatusWizardSte­­pNQTTest'
> >> > failed: IView.add_Load(null); Expected #1, Actual #0.
> >> > IView.add_Init(System.EventHandler); Expected #1, Actual #0.
> >> > IView.add_Load(System.EventHandler); Expected #1, Actual #0.
> >> > IView.add_Unload(System.EventHandler); Expected #1, Actual #0.
> >> > IView.add_PreRender(System.EventHandler); Expected #1, Actual #0.
> >> >        Rhino.Mocks.Exceptions.ExpectationViolationException:
> >> > IView.add_Load(null); Expected #1, Actual #0.
> >> >        IView.add_Init(System.EventHandler); Expected #1, Actual #0.
> >> >        IView.add_Load(System.EventHandler); Expected #1, Actual #0.
> >> >        IView.add_Unload(System.EventHandler); Expected #1, Actual #0.
> >> >        IView.add_PreRender(System.EventHandler); Expected #1, Actual #0.
> >> >        at Rhino.Mocks.MockRepository.VerifyAll()
>
> >> > 0 passed, 1 failed, 0 skipped, took 0.53 seconds (Ad hoc).
>
> >> > On May 21, 11:00 am, DomsRoberts <[email protected]> wrote:
> >> >> I have an interface that has events in it.
> >> >> public interface IView
> >> >>         {
> >> >>                 bool IsPostBack { get; }
> >> >>                 event EventHandler Init;
> >> >>                 event EventHandler Load;
> >> >>                 event EventHandler Unload;
> >> >>         event EventHandler PreRender;
> >> >>                 void DataBind();
> >> >>         }
>
> >> >> And I just want to test one of the methods. I am setting up an
> >> >> expectation on the methods and using ReplayAll and VerifyAll to test
> >> >> it.
> >> >> But when I verifyAll I get and ExpectationViolationException on
> >> >> IView.add_Load and each of the other events.
>
> >> >> How do I get around this? At the moment I am using a DynamicMock to
> >> >> mock the Interface.
>
> >> >> --
> >> >> 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 
> >> > 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 
> >> athttp://groups.google.com/group/rhinomocks?hl=en.-Hide quoted text -
>
> >> - Show quoted text -
>
> > --
> > 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 
> athttp://groups.google.com/group/rhinomocks?hl=en.- Hide quoted text -
>
> - Show quoted text -

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