コード例 #1
0
 public void WaitingThreads()
 {
     WaitNode node = new WaitNode();
     FIFOWaitQueue queue = new FIFOWaitQueue();
     Assert.AreEqual(0, queue.WaitingThreads.Count);
     Assert.IsFalse(queue.IsWaiting(Thread.CurrentThread));
     queue.Enqueue(node);
     Assert.AreEqual(1, queue.WaitingThreads.Count);
     Assert.IsTrue(queue.IsWaiting(Thread.CurrentThread));
 }
コード例 #2
0
        public void WaitingThreads()
        {
            WaitNode      node  = new WaitNode();
            FIFOWaitQueue queue = new FIFOWaitQueue();

            Assert.AreEqual(0, queue.WaitingThreads.Count);
            Assert.IsFalse(queue.IsWaiting(Thread.CurrentThread));
            queue.Enqueue(node);
            Assert.AreEqual(1, queue.WaitingThreads.Count);
            Assert.IsTrue(queue.IsWaiting(Thread.CurrentThread));
        }
コード例 #3
0
 public void EnqueueAndDequeueElements()
 {
     WaitNode node = new WaitNode();
     WaitNode node1 = new WaitNode();
     FIFOWaitQueue queue = new FIFOWaitQueue();
     Assert.AreEqual(null, queue.Dequeue());
     queue.Enqueue(node1);
     queue.Enqueue(node);
     Assert.AreEqual(2, queue.Length);
     Assert.IsTrue(queue.HasNodes);
     Assert.AreEqual(node1, queue.Dequeue());
     Assert.AreEqual(node, queue.Dequeue());
     Assert.IsFalse(queue.HasNodes);
 }
コード例 #4
0
        public void EnqueueAndDequeueElements()
        {
            WaitNode      node  = new WaitNode();
            WaitNode      node1 = new WaitNode();
            FIFOWaitQueue queue = new FIFOWaitQueue();

            Assert.AreEqual(null, queue.Dequeue());
            queue.Enqueue(node1);
            queue.Enqueue(node);
            Assert.AreEqual(2, queue.Length);
            Assert.IsTrue(queue.HasNodes);
            Assert.AreEqual(node1, queue.Dequeue());
            Assert.AreEqual(node, queue.Dequeue());
            Assert.IsFalse(queue.HasNodes);
        }
コード例 #5
0
        public void IsWaitingWithNullThread()
        {
            FIFOWaitQueue queue = new FIFOWaitQueue();

            Assert.IsFalse(queue.IsWaiting(null));
        }
コード例 #6
0
        public void FIFOWaitQueueNoNodesCount()
        {
            FIFOWaitQueue queue = new FIFOWaitQueue();

            Assert.AreEqual(0, queue.Length);
        }
コード例 #7
0
 public void IsWaitingWithNullThread()
 {
     FIFOWaitQueue queue = new FIFOWaitQueue();
     Assert.IsFalse(queue.IsWaiting(null));
 }
コード例 #8
0
 public void FIFOWaitQueueNoNodesCount()
 {
     FIFOWaitQueue queue = new FIFOWaitQueue();
     Assert.AreEqual(0, queue.Length);
 }