public void GivenAnEmptyList_WhenCallAddMultipleTimes_ThenCallPopWithIndexReturnCorrectItem() { GenDLList <int> l = new GenDLList <int>(); l.Add(1); l.Add(2); l.Add(3); l.Add(4); l.Add(5); Assert.Equal(5, l.Count); Assert.Equal(1, l.Pop(0)); Assert.Equal(4, l.Count); Assert.Equal(2, l.Pop(0)); Assert.Equal(3, l.Count); }
public void GivenAnEmptyList_WhenCallAppend_ThenCallPopReturnAppendedItem() { GenDLList <int> l = new GenDLList <int>(); l.Add(5); Assert.Equal(5, l.Pop()); }
public void GivenAPopulatedList_WhenCallPopWithInvalidIndex_ThenThrowEmptyListException() { GenDLList <int> l = new GenDLList <int>(); l.Add(1); l.Add(2); l.Add(3); Assert.Throws <InvalidListIndexException>(() => l.Pop(10)); }
public void GivenAnEmptyList_WhenCallAppendMultipleTimes_ThenCallPopReturnAppendedItemsInReverseOrder() { GenDLList <int> l = new GenDLList <int>(); l.Add(1); l.Add(2); l.Add(3); l.Add(4); l.Add(5); Assert.Equal(5, l.Count); Assert.Equal(5, l.Pop()); Assert.Equal(4, l.Count); Assert.Equal(4, l.Pop()); Assert.Equal(3, l.Count); Assert.Equal(3, l.Pop()); Assert.Equal(2, l.Count); Assert.Equal(2, l.Pop()); Assert.Equal(1, l.Count); Assert.Equal(1, l.Pop()); Assert.Equal(0, l.Count); Assert.Throws <EmptyListException>(() => l.Pop()); }
public void GivenAnEmptyList_WhenCallPopWithIndex_ThenThrowEmptyListException() { GenDLList <int> l = new GenDLList <int>(); Assert.Throws <EmptyListException>(() => l.Pop(1)); }