Hi Ralph,

What's the issue here?

Take your Presenter and inject an IDataProvider mock that expects a
GetData call and raises the GetDataComplete event.

There's actually a bunch of things you need to test here:
1. That someone registers to to the GetDataComplete event
2. That the sync gateway method "GetData" is called
3.  That after the event is raised someone sets the view.Data to
EventArgs.Data.

If you need help with specific syntax, let me or oren know.

-- Justin
Microsoft Silverlight Toolkit Program Manager

On Feb 4, 11:47 am, Ralph Balck <[email protected]> wrote:
> Hi,
>
> I have a presenter that subscribes to an event in my data provider.
> When the presenter asks for data, the provider fires an event (with
> the data as an eventArg) and the presenter catches that event and sets
> a property with the data.
>
> I want to test that the presenter did indeed set that property.  Heres
> my presenter:
>
>     public class Presenter
>     {
>         private IView view;
>         private IDataProvider provider = new DataProvider();
>
>         public Presenter(IView view)
>         {
>             this.view = view;
>             provider.GetDataComplete += new ProjectEventHandler
> (GetDataComplete);
>         }
>
>         public void GetData(int ID)
>         {
>             provider.GetData(ID);
>         }
>
>         private void GetDataComplete(object sender, DataEventArgs e)
>         {
>             view.Data = e.Data; //this is what i want to test
>         }
>     }
>
> I really have no idea how to go about mocking these asychronous
> provider calls.  Can anyone shed some light?
> Thanks!

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