Thanks Chris,
I seen this example,
But I had error in my View code.
Insead of this
  public interface IView
    {
        event EventHandler SaveEventHandler;
    }

I used this code, and have error. I am new with events :)
  public interface IView
    {
        EventHandler SaveEventHandler{get;set;}
    }

On 8 авг, 09:33, Chris Missal <[email protected]> wrote:
> Check this page 
> out:http://ayende.com/Wiki/Rhino+Mocks+3.5.ashx#Howtoraiseevents
>
> [Test]
> public void RaisingEventOnViewUsingExtensionMethod()
> {
>    var mocks = new MockRepository();
>    IView view = mocks.DynamicMock<IView>();
>    Presenter p = new Presenter(view);
>
>    view.Raise(x => x.Load += null, this, EventArgs.Empty);
>
>    Assert.IsTrue(p.OnLoadCalled);
>
>
>
> }
> On Fri, Aug 7, 2009 at 11:59 PM, shapovalov <[email protected]> wrote:
>
> > Hi,
>
> > I want to mock events in my MVP application
> > I have this code
>
> >            IToolbar toolbar = Mocks.StrictMock<IToolbar>();
> >            toolbar.SaveEventHandler += null;
> >            IEventRaiser raiser = LastCall.IgnoreArguments
> > ().GetEventRaiser(); //exception here
>
> > But I have exception
> > System.InvalidOperationException: Previous method
> > 'IToolbar.get_SaveEventHandler();' requires a return value or an
> > exception to throw.
>
> > I can't understand what is wrong. Should I return somthing?.
>
> > Does anybody can help me to understand it?
> > How can I use mocking for events in Rhino Mocks 3.5. All examples than
> > I tryed was not working.
>
> --
> Chris Missalhttp://chrismissal.lostechies.com/
--~--~---------~--~----~------------~-------~--~----~
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