static void LinkedListMain() { var list = new DataStructures.LinkedList.LinkedList <int>(); list.Add(1); list.Add(3); list.Add(5); list.AddTail(12); var head = list.Head; var nextItem = head.Next; var oldNext = nextItem.Next; nextItem.Next = new ListNode <int>(555, oldNext); Print(list); Console.WriteLine(list[1]); list[4] = 44; Print(list); list.Remove(5); Print(list); list.Add(5); list.Remove(6); Print(list); }
public void TestRemove_ShouldRemoveElementIfExists(int element, int[] expectedResult) { _linkedList.Remove(element); var result = _linkedList.ToArray(); result.Should().BeEquivalentTo(expectedResult); }