public void ListThrowsExceptionIfIndexOutOfRangeWhenRemoving() { var linkedList = new GenericLinkedListImplementation <string>(); linkedList.AddNode("mother"); linkedList.AddNode("father"); linkedList.AddNode("son"); Assert.Throws <IndexOutOfRangeException>(() => linkedList.RemoveAt(linkedList.Length + 1)); }
public void ListRemovesAtASpecificIndex() { var linkedList = new GenericLinkedListImplementation <string>(); linkedList.AddNode("mother"); linkedList.AddNode("father"); linkedList.AddNode("son"); linkedList.RemoveAt(1); Assert.Equal(2, linkedList.Length); Assert.Equal(linkedList.GetLast.Value, linkedList.GetAtIndex(1).Value); }