public static void Test() { QueueImplByStack q = new QueueImplByStack(); for (int i = 0; i < 10; i++) { q.Enqueue(i); } Assert.AreEqual(10, q.Count()); int[] dequeuedItem = new int[10]; for (int i = 0; i < 10; i++) { dequeuedItem[i] = q.Dequeue(); } Assert.AreEqual(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, dequeuedItem); }
public static void Test() { QueueImplByStack q = new QueueImplByStack(); for (int i = 0; i < 10; i++) q.Enqueue(i); Assert.AreEqual(10, q.Count()); int[] dequeuedItem = new int[10]; for (int i = 0; i < 10; i++) { dequeuedItem[i] = q.Dequeue(); } Assert.AreEqual(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }, dequeuedItem); }