Thanks for the input Justin. I went about making a fake DataProvider, modifying the Presenter to accept either a default(real) provider or a my fake provider. Now I have a test to determine if view.Data is set by EventArgs.Data. I still have to test if someone registers the event, but i dont think that should be too hard.
Thanks! Ralph On Feb 4, 2:23 pm, Justin-Josef Angel <[email protected]> wrote: > 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 -~----------~----~----~----~------~----~------~--~---
