public virtual void TestCoreEvent() { IEventCounterFactory counterFactory = new SimpleEventCounterFactory(new EventCounterHandlerTest.ToLogCounter ()); EventCounterHandler.GetInstance().Register(counterFactory); for (int i = 0; i < COUNT; ++i) { EventCounterHandler.GetInstance().OnEvent(CoreEvent.PROCESS, null, GetType()); } EventCounterHandler.GetInstance().Unregister(counterFactory); }
public virtual void TestDefaultCoreEvent() { int EVENTS_COUNT = 10001; IEventCounterFactory counterFactory = new SimpleEventCounterFactory(new EventCounterHandlerTest.ToLogDefaultCounter ()); EventCounterHandler.GetInstance().Register(counterFactory); EventCounterHandlerTest.MetaInfoCounter counter = new EventCounterHandlerTest.MetaInfoCounter(); for (int i = 0; i < EVENTS_COUNT; ++i) { EventCounterHandler.GetInstance().OnEvent(CoreEvent.PROCESS, counter, GetType()); } EventCounterHandler.GetInstance().Unregister(counterFactory); NUnit.Framework.Assert.AreEqual(counter.events_count, EVENTS_COUNT); }