public void AddAfterItemThatDoesntExist() { SinglyLinkedList list = new SinglyLinkedList(); list.AddLast("foo"); list.AddLast("bar"); list.AddAfter("cat", "grille"); }
public void AddAfterLastItem() { SinglyLinkedList list = new SinglyLinkedList(); list.AddLast("foo"); list.AddLast("bar"); list.AddAfter("bar", "grille"); var expected = new string[] { "foo", "bar", "grille" }; CollectionAssert.AreEqual(expected, list.ToArray()); }
public void AddAfter() { SinglyLinkedList list = new SinglyLinkedList(); list.AddLast("foo"); list.AddLast("grille"); // NOTE: This assert isn't necessary. It is merely here to remind you of / verify the state of the list prior to inserting the new node. var expected = new string[] { "foo", "grille" }; CollectionAssert.AreEqual(expected, list.ToArray()); list.AddAfter("foo", "bar"); expected = new string[] { "foo", "bar", "grille" }; CollectionAssert.AreEqual(expected, list.ToArray()); }