public void Dequeue() { TransferQueue <string> queue = new TransferQueue <string>(3); queue.QueueFull += new TransferQueue <string> .QueueFullEventHandler(queue_QueueFull); queue.Enqueue("ELM0"); queue.Enqueue("ELM1"); queue.Enqueue("ELM2"); Assert.Throws <InvalidOperationException>(delegate() { queue.Dequeue(); }); queue.Enqueue("ELM3"); queue.Enqueue("ELM4"); Assert.AreEqual(queue.Dequeue(), "ELM3"); Assert.AreEqual(queue.Peek(), "ELM4"); queue.Enqueue("ELM5"); queue.Enqueue("ELM6"); Assert.Throws <InvalidOperationException>(delegate() { queue.Peek(); }); queue.Enqueue("ELM7"); queue.Enqueue("ELM8"); queue.Dequeue(); queue.Dequeue(); Assert.AreEqual(queue.Count, 0); }