public void TimerPriorityTest()
 {
     TimerChangeEntry target = new TimerChangeEntry(); // TODO: 初始化为适当的值
     long actual;
     actual = target.TimerPriority;
     Assert.Inconclusive( "验证此测试方法的正确性。" );
 }
 public void AddTimerSliceTest()
 {
     TimerChangeEntry target = new TimerChangeEntry(); // TODO: 初始化为适当的值
     bool actual;
     actual = target.AddTimerSlice;
     Assert.Inconclusive( "验证此测试方法的正确性。" );
 }
Esempio n. 3
0
        /// <summary>
        /// 处理添加或修改或移去的时间片
        /// </summary>
        private static void ProcessChangeQueue()
        {
            TimerChangeEntry[] timerChangeEntryArray = null;

            s_LockTimerChangeEntryChangeQueue.Enter();
            {
                if (s_TimerChangeEntryChangeQueue.Count > 0)
                {
                    timerChangeEntryArray = s_TimerChangeEntryChangeQueue.ToArray();
                    s_TimerChangeEntryChangeQueue.Clear();
                }
            }
            s_LockTimerChangeEntryChangeQueue.Exit();

            if (timerChangeEntryArray == null)
            {
                return;
            }

            for (int iIndex = 0; iIndex < timerChangeEntryArray.Length; iIndex++)
            {
                TimerChangeEntry timerChangeEntry = timerChangeEntryArray[iIndex];

                TimeSlice nonceTimer = timerChangeEntry.TimerSlice;
                long      newIndex   = timerChangeEntry.TimerPriority;

                // 先从当前的优先级时间片列表中移去
                if (nonceTimer.TimeSliceDictionary != null)
                {
                    nonceTimer.TimeSliceDictionary.Remove(nonceTimer);
                }

                // 如果是添加的话,初始化时间片数据
                if (timerChangeEntry.AddTimerSlice == true)
                {
                    nonceTimer.NextTime = DateTime.Now + nonceTimer.DelayTime; // 计算下次调用的延迟的时间(m_Delay只计算使用一次)
                    nonceTimer.Adding   = 0;
                }

                // 如果优先级大于或等于零则添加到新的时间片列表中去,否则置空
                if (newIndex >= 0 && newIndex < 8)   // 8种时间片, -1 将不添加进列表,删除掉
                {
                    nonceTimer.TimeSliceDictionary = s_Timers[newIndex];
                    nonceTimer.TimeSliceDictionary.Add(nonceTimer, nonceTimer);
                }
                else
                {
                    nonceTimer.TimeSliceDictionary = null;
                }
            }
        }
 public void TimerChangeEntryConstructorTest()
 {
     TimeSlice tTimer = null; // TODO: 初始化为适当的值
     long newIndex = 0; // TODO: 初始化为适当的值
     bool isAdd = false; // TODO: 初始化为适当的值
     TimerChangeEntry target = new TimerChangeEntry( tTimer, newIndex, isAdd );
     Assert.Inconclusive( "TODO: 实现用来验证目标的代码" );
 }