public void Peek_PushTwoItems_ReturnsHeadItem() { var queue = new ArrayQueue <int>(); queue.Enqueue(1); queue.Enqueue(2); Assert.AreEqual(1, queue.Peek()); }
public void Pop_EmptyStack_ThrowsException() { var queue = new ArrayQueue <int>(); Assert.Throws <InvalidOperationException>(() => { queue.Dequeue(); }); }
public void Count_PushOneItem_ReturnsOne() { var queue = new ArrayQueue <int>(); queue.Enqueue(1); Assert.AreEqual(1, queue.Count); Assert.IsFalse(queue.IsEmpty); }
public void Peek_PushTwoItemsAndPop_ReturnsHeadElement() { var queue = new ArrayQueue <int>(); queue.Enqueue(1); queue.Enqueue(2); queue.Dequeue(); Assert.AreEqual(2, queue.Peek()); }
public void Capacity_EnqueueManyItems_DoubledCapacity() { var queue = new ArrayQueue <int>(); queue.Enqueue(1); queue.Enqueue(2); queue.Enqueue(3); queue.Enqueue(4); queue.Enqueue(5); Assert.AreEqual(8, queue.Capacity); }
static void TestArrayQueue() { ArrayQueue queue = new ArrayQueue(5); queue.Enqueue(10); queue.Enqueue(20); queue.Enqueue(30); //Console.WriteLine(queue.Dequeue()); queue.Dequeue(); queue.Dequeue(); queue.Enqueue(40); queue.Enqueue(50); queue.Enqueue(60); queue.Enqueue(70); queue.Dequeue(); queue.Enqueue(80); Console.WriteLine(queue); }
public void IsEmpty_EmptyQueue_ReturnsTrue() { var queue = new ArrayQueue <int>(); Assert.IsTrue(queue.IsEmpty); }