예제 #1
0
 public void TestPeekEmptyQueue()
 {
     // ARRANGE
     QueueLab.queue myQueue = new QueueLab.queue(1);
     // ACT
     // ASSERT
     Assert.Throws <QueueLab.queueEmptyException>(() => myQueue.peek());
 }
예제 #2
0
        public void TestPeek()
        {
            // ARRANGE
            QueueLab.queue myQueue = new QueueLab.queue(1);
            String         item = "queueItem";
            String         actual, expected;

            expected = item;
            // ACT
            myQueue.enqueue(item);
            actual = myQueue.peek();
            // ASSERT
            Assert.Equal(expected, actual);
        }
예제 #3
0
        static void Main(string[] args)
        {
            QueueLab.queue myQueue = new QueueLab.queue(2);
            String         item = "queueItem";
            String         actual, expected;

            expected = "queueItem3";
            myQueue.enqueue(item + "1");
            myQueue.enqueue(item + "2");
            myQueue.dequeue();
            myQueue.enqueue(item + "3");
            myQueue.dequeue();
            actual = myQueue.peek();
        }
예제 #4
0
        public void TestEnqueue()
        {
            // ARRANGE
            QueueLab.queue myQueue = new QueueLab.queue(2);
            String         item = "queueItem";
            String         actual, expected;

            expected = "queueItem1";
            // ACT
            myQueue.enqueue(item + "1");
            myQueue.enqueue(item + "2");
            actual = myQueue.peek();
            // ASSERT
            Assert.Equal(expected, actual);
        }