示例#1
0
        public void T09_EnqDeq2Enqueue3GetArray()
        {
            que.Enqueue(1);
            que.Enqueue(2);
            que.Dequeue();
            que.Dequeue();
            que.Enqueue(17);
            que.Enqueue(27);
            que.Enqueue(37);
            int[] inarr  = { 16, 27, 36 };
            int[] outarr = que.ToArray();
            foreach (int x in inarr)
            {
                Console.Write("{0} ", x);
            }
            Console.WriteLine();
            foreach (int x in outarr)
            {
                Console.Write("{0} ", x);
            }
            Console.WriteLine();
            Assert.AreEqual(inarr.Length, outarr.Length);
            int i = 0;

            foreach (int x in outarr)
            {
                Assert.AreEqual(inarr[i], x);
                i += 1;
            }
        }
示例#2
0
 public void T03_EnqueueDequeue()
 {
     que.Enqueue(17);
     que.Dequeue();
     Assert.AreEqual(que.Count, 0);
 }