public void TestDefaultMethodMatching() { // create the event source, and a listener to wire to an event (s) on the source PingSource source = new PingSource(); PingListener listener = new PerversePingListener(); // wire them up IEventHandlerValue wirer = new AutoWiringEventHandlerValue(); wirer.EventName = "^Ping$"; wirer.MethodName = ".+${event}.+"; // matches 'WhatClubDoYouUsePingAhGood' wirer.Wire(source, listener); // raise the event on the source source.OnPing(); // ascertain that the event listener was not notified of the raised event Assert.IsTrue(listener.GotPing, "The listener was not notified of the raised event."); Assert.IsFalse(listener.GotPinging, "The listener was (incorrectly) notified of an event that wasn't raised."); Assert.IsFalse(listener.GotPinged, "The listener was (incorrectly) notified of an event that wasn't raised."); }
public void TestDefaultMethodMatching () { // create the event source, and a listener to wire to an event (s) on the source PingSource source = new PingSource (); PingListener listener = new PerversePingListener (); // wire them up IEventHandlerValue wirer = new AutoWiringEventHandlerValue (); wirer.EventName = "^Ping$"; wirer.MethodName = ".+${event}.+"; // matches 'WhatClubDoYouUsePingAhGood' wirer.Wire (source, listener); // raise the event on the source source.OnPing (); // ascertain that the event listener was not notified of the raised event Assert.IsTrue (listener.GotPing, "The listener was not notified of the raised event."); Assert.IsFalse (listener.GotPinging, "The listener was (incorrectly) notified of an event that wasn't raised."); Assert.IsFalse (listener.GotPinged, "The listener was (incorrectly) notified of an event that wasn't raised."); }