title: How to test event registration in Rhino Mocks
body: <p>I am trying to write a Rhino Mocks test to verify that I have registered for an event. Here is my test:</p>
  
  <pre><code>   var dataSvc = MockRepository.GenerateStub&lt;IDataService&gt;();
     Search srch = new Search(dataSvc, vr); 
     dataSvc.GetCarriersCompleted += srch.OnCarrierDataReturned;
     dataSvc.AssertWasCalled(x =&gt; x.GetCarriersCompleted += Arg&lt;GetCarriersCompletedEventArgs&gt;.Is.Anything);
  </code></pre>
  
  <p>My code is just a simple register for event like this:</p>
  
  <pre><code>    public void GetCarrierList()
      {
          try
          {
              _dataService.GetCarriersCompleted += OnCarrierDataReturned; ; //hangedEventHandler(OnDataReturned);
              _dataService.GetCarriersAsync(_param);
  
          }
          catch (Exception ex)
          {
  
          }
      }
  
      public void OnCarrierDataReturned(object sender, GetCarriersCompletedEventArgs e)
      {
         // get results
      }
  </code></pre>
  
  <p>My data service looks like this:</p>
  
  <pre><code>    void GetCarriersAsync(System.Collections.Generic.Dictionary&lt;string, string&gt; param);
      event System.EventHandler&lt;GetCarriersCompletedEventArgs&gt; GetCarriersCompleted;
  </code></pre>
  
  <p>I can't figure out what Rhino Mocks needs for this test. The error is:</p>
  
  <p>Error   7   Cannot implicitly convert type 'MACS2SLApp.MACSWcfServiceProxy.GetCarriersCompletedEventArgs' to 'System.EventHandler'    C:\Documents and Settings\600124238\My Documents\MACS3\Prototype\Web UI\MACSUnitTests\MACSUnitTests.cs  126 68  MACSUnitTests</p>
  
  <p>Any ideas would be appreciated.</p>
  
  <p>thanks,
  Bill44077</p>