public void TestAddTail_ShouldAddElementsAtTheEnd() { //act _linkedList.AddTail(1); _linkedList.AddTail(2); _linkedList.AddTail(3); //assert var result = _linkedList.ToArray(); result.Should().BeEquivalentTo(new[] { 568, 666, 0, 1, 2, 3 }); }
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); }