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); }
public void Enqueue() { TransferQueue <string> queue = new TransferQueue <string>(3); queue.Enqueue("ELM0"); Assert.AreEqual(queue.Peek(), "ELM0"); queue.Enqueue("ELM1"); Assert.AreEqual(queue.Peek(), "ELM0"); queue.Enqueue("ELM2"); Assert.Throws <InvalidOperationException>(delegate() { queue.Enqueue("ELM3"); }); Assert.AreEqual(queue.Peek(), "ELM0"); }
public void QueueFull() { TransferQueue <string> queue = new TransferQueue <string>(3); queue.QueueFull += new TransferQueue <string> .QueueFullEventHandler(queue_QueueFull); queue.Enqueue("ELM0"); queue.Enqueue("ELM1"); queue.Enqueue("ELM2"); // the queue is empty? Assert.Throws <InvalidOperationException>(delegate() { queue.Peek(); }); // the queue has been cleaned? queue.Enqueue("ELM3"); Assert.AreEqual(queue.Count, 1); }
/// <summary> /// While this test case is not for documentation rules, we use this /// to verify the bug where multiline interpolated string results in incorrect line numbers. /// </summary> private static void TestCaseForIssue105Part1() { int value; var singleLineDummyString = $@"Some Text"; // Declare dummy string. var dummyString = string.Format( $@" Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque {0} penatibus et magnis dis parturient montes, nascetur ridiculus mus. ", value); // Do something with the dummy string. TransferQueue.Enqueue(dummyString); }