The application I am testing is full of events based on custom delegates, such as this:
public delegate void NameChangedHandler(string name);
public event NameChanged OnNameChanged;
...
public void ChangeYourName(string newName)
{
if( NameChanged != null )
NameChanged(newName);
}
I want to mock out the class producing these events and raise these events to the class under test.
I know that FakeItEasy can use Raise.With()
for raising events with the traditional event signatures of MyHandler(object sender, EventArgs e)
or MyHandler(EventArgs e)
, but I don't know what to do in my situation.
Any ideas?