public void InsertBeforeNonExistentElementThrowsException() { //Arrange var l = new SingleLinkedList <int>(); l.AddLast(1); l.AddLast(2); l.AddLast(3); l.AddLast(4); //Act //Assert Assert.Throws <ArgumentException>(() => l.AddBeforeElement(9, 5)); }
public void InsertBeforeLastElement() { //Arrange var l = new SingleLinkedList <int>(); l.AddLast(1); l.AddLast(2); l.AddLast(3); l.AddLast(4); //Act l.AddBeforeElement(9, 4); //Assert Assert.AreEqual(l.Contains(9), true); Assert.AreEqual(l.GetElementPosition(9), 4); }