I have the problem to fake a call to an event. I use NUnit as well. Here is the code:
[Test, Isolated]
public void TestEventCall
{
... some definitions
string resultingServer, resultingItem;
int resultingValue;
// here I set up the listener
opc.OnEventFired += (server, itemName, value) =>
{
resultingServer = server;
resultingItem = itemName;
resultingValue = value;
}
Isolate.Invoke.Event (() => opc.OnEventFired += null, serverName, itemName, 200);
Assert.AreEqual (resultingServer, serverName);
Assert.AreEqual (resultingItem, itemName);
Assert.AreEqual (resultingValue, 200);
}
The issue is it does not compile. The error states that the event is not supported and I shall use the accessor methode 'add_OnEventFired'.
The event is however public at the class to be tested.
Can anyone help me here?