public int RegisterSingle(int instances) { var hub = new EventHub(); for (var i = 0; i < instances; i++) { var handler = new SyncBaseCountingHandler(); hub.Register(handler); } return(hub.GetRegisteredHandlers <BaseEvent>().Count()); }
public int DerivedClassMatchHandled(int iterations) { var hub = new EventHub(); var handler = new SyncBaseCountingHandler(); hub.Register(handler); for (var i = 0; i < iterations; i++) { hub.AddEvent(new DerivedEvent()); hub.AddEvent(42); //Should not handle this } return(handler.HandleCount); }