Ejemplo n.º 1
0
        public void Opg2b_StackFromQueue_01_ContentsOk(string input_str, string expected_str)
        {
            // Arrange
            Queue <int> queue         = new Queue <int>();
            List <int>  input_list    = TestUtils.ListFromString(input_str);
            List <int>  expected_list = TestUtils.ListFromString(expected_str);

            foreach (int x in input_list)
            {
                queue.Enqueue(x);
            }

            // Act
            Stack <int> stack = BAI_Afteken1.Opdr2bStackFromQueue(queue);

            // Assert
            Assert.IsTrue(stack.SequenceEqual(expected_list));
        }
Ejemplo n.º 2
0
        public void Opg2b_StackFromQueue_02_QueueBecomesEmpty(string input_str)
        {
            // Arrange
            Queue <int> queue      = new Queue <int>();
            List <int>  input_list = TestUtils.ListFromString(input_str);

            foreach (int x in input_list)
            {
                queue.Enqueue(x);
            }
            int expected = 0;

            // Act
            Stack <int> stack  = BAI_Afteken1.Opdr2bStackFromQueue(queue);
            int         actual = queue.Count;

            // Assert
            Assert.AreEqual(expected, actual);
        }