public void QueueViaWiseArray_Empty_InvalidOperationException() { QueueViaWiseArray <int> queue = new QueueViaWiseArray <int>(); Assert.Throws <InvalidOperationException>( () => queue.Dequeue()); }
public void QueueViaWiseArrayTests_Time() { QueueViaWiseArray <string> queue = new QueueViaWiseArray <string>(2); Stopwatch stopwatch = Stopwatch.StartNew(); queue.Enqueue("A"); queue.Enqueue("B"); queue.Dequeue(); queue.Enqueue("C"); queue.Enqueue("D"); //for (int i = 0; i < 10000; i++) //{ // queue.Enqueue("A"); //} //for (int i = 0; i < 1000; i++) //{ // queue.Dequeue(); //} //for (int i = 0; i < 500; i++) //{ // queue.Enqueue("A"); //} stopwatch.Stop(); Assert.Pass(stopwatch.Elapsed.ToString()); }
public void QueueViaWiseArray_Dequeue_Succed() { QueueViaWiseArray <int> queue = new QueueViaWiseArray <int>(); queue.Enqueue(10); queue.Enqueue(5); int result = queue.Dequeue(); int expected = 10; Assert.AreEqual(expected, result); }