Example #1
0
        public void ReturnValuesInFIFOOrderingAfterModifications()
        {
            QueueViaStacks <int> queue = CreateQueueViaStacksFromArray(new [] { 9, 6, 1, 2 });

            Assert.Equal(9, queue.Peek());
            Assert.Equal(9, queue.Remove());
            Assert.Equal(6, queue.Remove());
            queue.Add(3);
            queue.Add(4);
            CollectionsEqual(new [] { 1, 2, 3, 4 }, queue);
        }
Example #2
0
 private static void CollectionsEqual(int[] expected, QueueViaStacks <int> actual)
 {
     Assert.Equal(expected.Length, actual.Count());
     foreach (var item in expected)
     {
         Assert.Equal(item, actual.Remove());
     }
 }