public void TestPopFront() { var list = new DoubleEndedLinkedList <int>(); int[] values = { -4, 3, 5, -6, 3, 5, -20, 0 }; // Push the items from 'values' array to the list foreach (int val in values) { list.PushBack(val); } // Repeatedly call PopFront until list gets empty int i = 0; int expected_size = values.Length; while (!list.IsEmpty()) { Assert.AreEqual(expected_size--, list.Size); Assert.AreEqual(values[i++], list.PopFront()); } }
public void PopFrontThrowsIfCalledOnEmptyList() { var list = new DoubleEndedLinkedList <int>(); Assert.Throws <IndexOutOfRangeException>(() => list.PopFront()); }