Ejemplo n.º 1
0
        public void Test_Dequeue_PopBack()
        {
            // Arrange
            var play_queue = new BearPlayer.Bear_Player.Dequeue();

            // Act
            play_queue.Push_Front("1");
            play_queue.Push_Back("2");
            play_queue.Push_Front("3");
            play_queue.Push_Back("4");
            play_queue.Push_Front("5");

            Assert.IsTrue(play_queue.Count() == 5);
            Assert.AreEqual(play_queue.view_Top(), "5");

            string first  = play_queue.Pop_Back();
            string second = play_queue.Pop_Back();
            string third  = play_queue.Pop_Back();

            // Assert
            Assert.IsTrue(play_queue.Count() == 2);
            Assert.AreEqual(first, "4");
            Assert.AreEqual(second, "2");
            Assert.AreEqual(third, "1");
            Assert.AreEqual(play_queue.view_Top(), "5");
        }
Ejemplo n.º 2
0
        public void Test_Dequeue_ViewTop()
        {
            // Arrange
            var play_queue = new BearPlayer.Bear_Player.Dequeue();

            // Act

            // Assert
            Assert.IsNull(play_queue.view_Top());

            play_queue.Push_Back("1");
            Assert.AreEqual(play_queue.view_Top(), "1");

            play_queue.Push_Front("2");
            play_queue.Push_Front("3");
            Assert.AreEqual(play_queue.view_Top(), "3");

            play_queue.Pop_Front();
            Assert.AreEqual(play_queue.view_Top(), "2");
        }
Ejemplo n.º 3
0
        public void Test_Dequeue_PushFront()
        {
            // Arrange
            var play_queue = new BearPlayer.Bear_Player.Dequeue();

            // Act
            play_queue.Push_Front("1");
            play_queue.Push_Front("2");
            play_queue.Push_Front("3");

            // Assert
            Assert.IsTrue(play_queue.Count() == 3);
            Assert.AreEqual(play_queue.view_Top(), "3");
        }