Jimmy hi,
given that your "Class Under Test" look somethign like:
public delegate void SampleEventDelegate(object sender, EventArgs e);
public class ClassUnderTest
{
public event SampleEventDelegate SampleEvent;
// A method that triggers the event:
public void FireEvent()
{
SampleEvent(this,null);
}
}
You can mock the "FireEvent" call like any call to other method:
[Test]
public void TestEvent()
{
Mock mock = MockManager.Mock(typeof(ClassUnderTest));
mock.ExpectCall("FireEvent");
// Create an instance of the ClassUnderTest class.
ClassUnderTest tested = new ClassUnderTest();
// Specify the method that will be triggered by the SampleEvent event.
tested.SampleEvent += delegate { System.Console.WriteLine("Hello, World!"); };
// Trigger the event
tested.FireEvent();
MockManager.Verify();
}
I hope this is what you need. If not please let me know