public void removeElement_whenFound(IDeque <SimpleLinkedValue> deque) { SimpleLinkedValue first = deque.Peek(); Assert.That(deque.Remove(first), Is.True); Assert.That(deque, HasCount((int)Capacity() - 1)); Assert.That(deque.Contains(first), Is.False); }
public void dequeue_whenPopulated(IDeque <SimpleLinkedValue> deque) { SimpleLinkedValue first = deque.Peek(); Assert.That(deque.Dequeue(), Is.SameAs(first)); Assert.That(deque, HasCount((int)Capacity() - 1)); Assert.That(deque.Contains(first), Is.False); }
public void add_whenPopulated(IDeque <SimpleLinkedValue> deque) { SimpleLinkedValue value = new SimpleLinkedValue((int)Capacity()); deque.Add(value); Assert.That(deque.Peek(), Is.Not.SameAs(value)); Assert.That(deque, HasCount((int)Capacity() + 1)); }
public void add_whenEmpty(IDeque <SimpleLinkedValue> deque) { SimpleLinkedValue value = new SimpleLinkedValue(1); deque.Add(value); Assert.That(deque.Peek(), Is.SameAs(value)); Assert.That(deque, HasCount(1)); }
public void peek_whenPopulated(LinkedDeque <SimpleLinkedValue> deque) { SimpleLinkedValue first = deque.first; Assert.That(deque.Peek(), Is.SameAs(first)); Assert.That(deque.first, Is.SameAs(first)); Assert.That(deque.Count, Is.EqualTo((int)Capacity())); Assert.That(deque.Contains(first), Is.True); }
public void removeElement_toEmpty(LinkedDeque <SimpleLinkedValue> deque) { while (!deque.IsEmpty) { SimpleLinkedValue value = deque.Peek(); Assert.That(deque.Remove(value), Is.True); Assert.That(deque.Contains(value), Is.False); } Assert.That(deque, emptyCollection <SimpleLinkedValue>()); }
public void contains_whenNotFound(LinkedDeque <SimpleLinkedValue> deque) { SimpleLinkedValue unlinked = new SimpleLinkedValue(1); Assert.That(deque.Contains(unlinked), Is.False); }