Пример #1
0
        /// <summary>
        ///Clear 的测试
        ///</summary>
        public void ClearTestHelper <ValueT>()
        {
            LockFreeQueue <ValueT> target = new LockFreeQueue <ValueT>(); // TODO: 初始化为适当的值

            target.Clear();
            Assert.Inconclusive("无法验证不返回值的方法。");
        }
Пример #2
0
        public void LockFreeQueueClear()
        {
            var queue = new LockFreeQueue <int>();

            queue.Enqueue(1);
            queue.Enqueue(2);
            queue.Enqueue(3);
            queue.Enqueue(4);
            queue.Enqueue(5);
            queue.Clear();
            Assert.AreEqual(queue.Count, 0);
        }
 public void ItShouldBePossibleToClearAQueueAndDequeueASingleItem()
 {
     var lfq = new LockFreeQueue<string>();
     var lele = new List<string>();
     for (int i = 0; i < ENQUEUED_DATA; i++)
     {
         lele.Add("TEST_" + i);
     }
     lfq.Enqueue(lele);
     Assert.AreEqual("TEST_0", lfq.DequeueSingle());
     lfq.Clear();
     Assert.IsNull(lfq.DequeueSingle());
 }
 public void ItShouldBePossibleToEnqueuAndDequeuNonNullableElements()
 {
     var lfq = new LockFreeQueue<int>();
     var lele = new List<int>();
     for (int i = 0; i < ENQUEUED_DATA; i++)
     {
         lele.Add(i);
     }
     lfq.Enqueue(lele);
     Assert.AreEqual(0, lfq.DequeueSingle());
     lfq.Clear();
     Assert.AreEqual(0,lfq.Count);
     Assert.AreEqual(0,lfq.DequeueSingle());
 }
        public void LockFreeQueueIntItShouldBePossibleToClearAQueueAndDequeueASingleItem()
        {
            var lfq  = new LockFreeQueue <string>();
            var lele = new List <string>();

            for (int i = 0; i < ENQUEUED_DATA; i++)
            {
                lele.Add("TEST_" + i);
            }
            lfq.Enqueue(lele);
            Assert.AreEqual("TEST_0", lfq.DequeueSingle());
            lfq.Clear();
            Assert.IsNull(lfq.DequeueSingle());
        }
        public void LockFreeQueueIntItShouldBePossibleToEnqueuAndDequeuNonNullableElements()
        {
            var lfq  = new LockFreeQueue <int>();
            var lele = new List <int>();

            for (int i = 0; i < ENQUEUED_DATA; i++)
            {
                lele.Add(i);
            }
            lfq.Enqueue(lele);
            Assert.AreEqual(0, lfq.DequeueSingle());
            lfq.Clear();
            Assert.AreEqual(0, lfq.Count);
            Assert.AreEqual(0, lfq.DequeueSingle());
        }
Пример #7
0
 public void CancelAllMessages()
 {
     m_messageQueue.Clear();
 }