<p>I have an object that I'm testing that raises an event.  What is the best way of using Rhino Mocks to check that it was raised?  </p>

<p>Best I could come up with (I am certain it gets better than this):</p>

<pre><code>public void MyCallback(object sender, EventArgs e) { _flag = true;}

[Test]
public void DoSomethingRaisesEvent() {
  _flag = false;
  using(_mocks.Record()) {
    Expect.Call(delegeate { _obj.DoSomething();});
  }
  using(_mocks.Playback()) {
    _obj = new SomethingDoer();
    _obj.SomethingWasDoneEvent += new EventHandler(MyHandler);
    Assert.IsTrue(_flag);
  }
}
</code></pre>

I'm not sure how your test actually calls the DoSomething() Method. Maybe you're missing something to fire the event. Other than that, I think you have are on the right track for testing events with Rhino Mocks
In any case, here is another way I like to deal with events:
```
```
[Test]
public void MyEventTest()
{

    IEventRaiser eventRaiser;

    mockView = _mocks.CreateMock<IView>();
    using (_mocks.Record())
    {
      mockView.DoSomethingEvent += null;
      eventRaiser = LastCall.IgnoreArguments();
    }
    using (_mocks.Playback())
    {
       new Controller(mockView, mockModel);
       eventRaiser.Raise(mockView, EventArgs.Empty);
    }
}
```
```