コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }