Couldn't agree more. Thanks for the validation as well. I think Roy Osherove wrote something about this awhile back in the TDD newgroup. I'll have to go check that out again. thanks, Bill
On Dec 9, 9:52 am, Stephen Bohlen <[email protected]> wrote: > My *strong* suspicion based on blog posts (or their absence) is that most > people doing SL development are not TDD proponents (made all the more so due > to the inherent friction in working with so runtime-coupled a framework as > SL). I suspect this is why you cannot find much info on the net about > mixing these two things (successfully). > > I can say one thing though: if you are able to do this successfully, it > sounds like the ecosystem (both the RM ecosystem and the SL ecosystem) could > benefit from your blogging about it and sharing with others :) > > Steve Bohlen > [email protected]http://blog.unhandled-exceptions.comhttp://twitter.com/sbohlen > > > > > > > > On Wed, Dec 8, 2010 at 8:40 PM, Bill44077 <[email protected]> wrote: > > Thanks Patrick - I'll give that a try. > > I'm surprised that I can't seem to find much info on this on the web - > > I would have thought that there would have been many SL4 folks doing > > TDD and using either RhinoMocks or MOQ. And since SL4 always uses > > async to talk to the WCF service I would think that would be what > > folks are doing. Aren't people doing TDD? > > regards, > > Bill > > > On Dec 8, 3:58 pm, Patrick Steele <[email protected]> wrote: > > > The Arg<> generic takes a type that represents your event signature. > > > So for your example, the following should work: > > > > service.AssertWasCalled(s => s.GetCarriersCompleted += > > > Arg<EventHandler<GetCarriersCompletedEventArgs>>.Is.Anything); > > > > --- > > > Patrick Steelehttp://weblogs.asp.net/psteele > > > > On Wed, Dec 8, 2010 at 11:38 AM, Bill44077 <[email protected]> > > wrote: > > > > Hi, > > > > I've been struggling for awhile now trying to figure out how to verify > > > > that an event gets attached to a mock. In the documentation is this: > > > > > Event registration > > > > > mock.Load += OnLoad; > > > > mock.AssertWasCalled(x => x.Load += Arg<LoadEvent>.Is.Anything); > > > > > I can't seem to figure out what some of these things are, like the > > > > Arg<LoadEvent>. My code attached an event like this in the Search > > > > object: > > > > > public void GetCarrierList() > > > > { > > > > try > > > > { > > > > _dataService.GetCarriersCompleted += new > > > > EventHandler<GetCarriersCompletedEventArgs>(OnCarrierDataReturned); > > > > _dataService.GetCarriersAsync(_param); > > > > > } > > > > catch (Exception ex) > > > > { > > > > > } > > > > } > > > > > the IDataService interface has this: > > > > > public interface IDataService : IMACSWcfService > > > > { > > > > void > > > > GetCarriersAsync(System.Collections.Generic.Dictionary<string, string> > > > > param); > > > > event System.EventHandler<GetCarriersCompletedEventArgs> > > > > GetCarriersCompleted; > > > > } > > > > > I am trying to write a test something like this: > > > > > [TestMethod] > > > > public void > > > > Search_GetCarrierList_Should_WireUp_GetCarriersCompleted() > > > > { > > > > IDataService dataSvc = > > > > MockRepository.GenerateStub<IDataService>(); > > > > Search srch = new Search(dataSvc, vr); > > > > srch.GetCarrierList(); > > > > dataSvc.GetCarriersCompleted += > > > > srch.OnCarrierDataReturned; > > > > dataSvc.AssertWasCalled(x => x.GetCarriersCompleted += > > > > Arg<GetCarriersCompletedEventArgs>.Is.Anything); > > > > > } > > > > > I've also tried: > > > > > dataSvc.AssertWasCalled(x => x.GetCarriersCompleted += > > > > Arg.Is.Anything); > > > > > It doesn't seem to know what "Anything" is. > > > > I would have thought this would be simple (and I'm sure that as soon > > > > as someone can point out what I'm doing wrong that it will be). But > > > > for now I'm confused. Please help. > > > > > thanks, > > > > Bill44077 > > > > > -- > > > > 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]<rhinomocks%2bunsubscr...@googlegrou > > ps.com> > > . > > > > 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]<rhinomocks%2bunsubscr...@googlegrou > > ps.com> > > . > > For more options, visit this group at > >http://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 at http://groups.google.com/group/rhinomocks?hl=en.
