public void ExceptionTest() { Assert.Throws <ArgumentException>(() => new TQueue <string>(-1)); Assert.Throws <ArgumentNullException>(() => new TQueue <Person>(null)); Assert.Throws <ArgumentException>(() => new TQueue <int>(-1)); Assert.Throws <ArgumentException>(() => queueCust1.Dequeque()); Assert.Throws <ArgumentException>(() => queueCust2.Peek()); }
public void EnqueueDequeueForeachTest1() { queueInt3.Enqueue(3); queueInt3.Enqueue(2); queueInt3.Dequeque(); int i = -1; int[] expected = new[] { 2, 3, 4, 5, 6, 7, 3, 2 }; foreach (var item in queueInt3) { Assert.AreEqual(expected[++i], item); } }
public void EnqueueDequeueForeachTest2() { queueCust4.Enqueue(p1); queueCust4.Enqueue(p1); queueCust4.Enqueue(p1); queueCust4.Dequeque(); int i = -1; Person[] expected = new[] { p2, p3, p1, p1, p1 }; foreach (var item in queueCust4) { Assert.AreEqual(expected[++i], item); } }