Exemplo n.º 1
0
        public void Dequeue_Empty_InvalidOperationException_NUnit()
        {
            // Arrange
            MyCustomQueue <int> queue = new MyCustomQueue <int>();

            // Assert
            Assert.Throws <InvalidOperationException>(() => queue.Dequeue());
        }
Exemplo n.º 2
0
        public void Dequeue_InputCorrectListStrings_NUnit()
        {
            // Arrange
            MyCustomQueue <string> queueStr = new MyCustomQueue <string>();

            string expected = "Kirill";

            // Act
            queueStr.Enqueue("Kirill");
            queueStr.Enqueue("Oleg");
            queueStr.Enqueue("Vasya");

            string result = queueStr.Dequeue();

            // Assert
            Assert.AreEqual(expected, result);
        }
Exemplo n.º 3
0
        public void Enqueue_InputCorrectListStrings_NUnit()
        {
            // Arrange
            MyCustomQueue <string> queueStr = new MyCustomQueue <string>();

            string[] expected = { "Kirill", "Oleg", "Vasya" };

            // Act
            queueStr.Enqueue("Kirill");
            queueStr.Enqueue("Oleg");
            queueStr.Enqueue("Vasya");

            bool result = expected.SequenceEqual(queueStr);

            // Assert
            Assert.IsTrue(result);
        }
Exemplo n.º 4
0
        public void Peek_InputCorrectListNumber_NUnit()
        {
            // Arrange
            MyCustomQueue <int> queue = new MyCustomQueue <int>();

            int expected = 10;

            // Act
            queue.Enqueue(10);
            queue.Enqueue(12);
            queue.Enqueue(2);
            queue.Enqueue(7);

            int result = queue.Peek();

            // Assert
            Assert.AreEqual(expected, result);
        }
Exemplo n.º 5
0
        public void Enqueue_InputCorrectListNumbers_NUnit()
        {
            // Arrange
            MyCustomQueue <int> queue = new MyCustomQueue <int>();

            int[] expected = { 10, 12, 2, 7 };

            // Act
            queue.Enqueue(10);
            queue.Enqueue(12);
            queue.Enqueue(2);
            queue.Enqueue(7);

            bool result = expected.SequenceEqual(queue);

            // Assert
            Assert.IsTrue(result);
        }