Пример #1
0
        public void Timer_EventSetFetch_NotFound()
        {
            // need to tick at least once
            int count            = 0;
            ManualResetEvent mre = new ManualResetEvent(false);

            TimerManager.AddEventSet("test18", 250, delegate(object sender, TimerManagerEventArg e)
            {
                count++;
                if (count >= 1)
                {
                    mre.Set();
                }
            }
                                     , false);
            mre.WaitOne(2000, false);
            TimerManagerEventset retVal = TimerManager.GetEventSetByID("test_foo");

            Assert.AreEqual(null, retVal, "value returned by the method should be null");
        }
Пример #2
0
        public void Timer_EventSetFetch_Normal()
        {
            // need to tick at least once
            int count            = 0;
            ManualResetEvent mre = new ManualResetEvent(false);

            TimerManager.AddEventSet("test17", 2456, delegate(object sender, TimerManagerEventArg e)
            {
                count++;
                if (count >= 1)
                {
                    mre.Set();
                }
            }
                                     , false);
            mre.WaitOne(2000, false);
            TimerManagerEventset retVal = TimerManager.GetEventSetByID("test17");

            Assert.AreEqual(2456, retVal.timeInbetweenTick, "Ticking time should be the right thing");
            Assert.AreEqual("test17", retVal.Id, "ID should be the right thing");
            Assert.AreEqual(false, retVal.isPaused, "Pause status should be the right thing");
        }