One thing that I forgot to mention is that this is a Silverlight 4 app
and it is making the typical async calls to the WCF Service. I don't
know if this is part of the problem with me not being able to get this
to work or not but might be an important part of the info.
thanks,
Bill44077

On Dec 8, 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].
For more options, visit this group at 
http://groups.google.com/group/rhinomocks?hl=en.

Reply via email to