We mock an interface which has an event on it like so:
public interface IThing<TKey, TValue>
{
event EventHandler<Message<TKey, TValue>> OnMessage;
}
Using NSubstitue we make a mock of the interface and try to raise the event using NSubstitute guidelines:
var mockThing = Substitute.For<IThing>();
mockThing.OnMessage += Raise.EventWith(???)
Despite many attempts, we can't get that line to compile - is it just a case of placing the generic types and arguments in the correct position?
The actual OnMessage() function called will look like this:
private void OnMessage(object sender, Message<string, string> message)