I have got following Functional Test. Test purpose is to check if my SNMP Manager works correctly after SNMP Trap message being triggered.
The problem is, my test is working fine only in debug mode.
I tried to use "ManualResetEvent" and also "Thread.Sleep" to help event being received by "Manager".
[TestMethod]
public void SendingTrap_To_Running_SnmpManager()
{
_sut.Engine.Start();
bool trapReciverHandlerWasTriggered = false;
_sut.WatcherTrapV2ReceivedDelegate = (sender, args) =>
{
trapReciverHandlerWasTriggered = true;
};
Messenger.SendTrapV2(//args are not imporant in this case);
Thread.Sleep(2000);
Assert.IsTrue(trapReciverHandlerWasTriggered, "Trap was not recived by SNMP-Manager.");
_sut.Engine.Stop();
}
Aucun commentaire:
Enregistrer un commentaire