public void Should_Check_Length_One_Enqueue_Dequeue() { //arrange var queue = new MyLinkedListQueue <int>(); //act queue.Enqueue(1); var result = queue.Dequeue(); Action act = () => queue.Dequeue(); //assert result.ShouldBeEquivalentTo(1); queue.Count.ShouldBeEquivalentTo(0); act.ShouldThrow <InvalidOperationException>(); }
public void Should_Check_Length_One_Enqueue_Dequeue_Multiple() { //arrange var queue = new MyLinkedListQueue <int>(); //act queue.Enqueue(1); queue.Dequeue(); queue.Enqueue(2); var result = queue.Dequeue(); //assert result.ShouldBeEquivalentTo(2); queue.Count.ShouldBeEquivalentTo(0); }
public void Should_Dequeue_Throw_If_Empty() { //arrange var queue = new MyLinkedListQueue <int>(); //act Action act = () => queue.Dequeue(); //assert act.ShouldThrow <InvalidOperationException>(); }
public void Should_Dequeue() { //arrange var queue = new MyLinkedListQueue <int>(); queue.Enqueue(1); //act var result = queue.Dequeue(); //assert result.ShouldBeEquivalentTo(1); queue.Count.ShouldBeEquivalentTo(0); }
public void Should_Dequeue_Multiple() { //arrange var queue = new MyLinkedListQueue <int>(); queue.Enqueue(1); queue.Enqueue(2); queue.Enqueue(3); queue.Enqueue(4); //act var first = queue.Dequeue(); var second = queue.Dequeue(); var third = queue.Dequeue(); var fourth = queue.Dequeue(); //assert first.ShouldBeEquivalentTo(1); second.ShouldBeEquivalentTo(2); third.ShouldBeEquivalentTo(3); fourth.ShouldBeEquivalentTo(4); queue.Count.ShouldBeEquivalentTo(0); }