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_Count()
        {
            // Arrange
            var play_queue = new BearPlayer.Bear_Player.Dequeue();

            // Act

            // Assert
            Assert.IsTrue(play_queue.Count() == 0);

            play_queue.Push_Front("1");
            Assert.IsTrue(play_queue.Count() == 1);

            for (int i = 2; i <= 10; ++i)
            {
                play_queue.Push_Back(i.ToString());
            }

            Assert.IsTrue(play_queue.Count() == 10);

            for (int i = 0; i < 6; ++i)
            {
                play_queue.Pop_Back();
            }

            Assert.IsTrue(play_queue.Count() == 4);
        }
Ejemplo n.º 3
0
        public void Test_Dequeue_PopBack_Empty()
        {
            // Arrange
            var play_queue = new BearPlayer.Bear_Player.Dequeue();

            // Act

            // Assert
            Assert.IsTrue(play_queue.Count() == 0);
            Assert.IsNull(play_queue.Pop_Back());
        }
Ejemplo n.º 4
0
        public void Test_Dequeue_Remove_Back()
        {
            // Arrange
            var play_queue = new BearPlayer.Bear_Player.Dequeue();

            // Act
            for (int i = 0; i < 15; ++i)
            {
                play_queue.Push_Back(i.ToString());
            }
            Assert.IsTrue(play_queue.Count() == 15);

            // Assert
            play_queue.Remove_Element("14");
            Assert.IsTrue(play_queue.Count() == 14);
            Assert.AreEqual(play_queue.Pop_Back(), "13");
        }