public void AddNodeAfterWhereSpecifiedNodeIsHead(object value) { Node firstNode = new Node("First"); LListDouble ll = new LListDouble(firstNode); Assert.Equal("First", ll.Head.Value); Node newNode = new Node(value); ll.AddNodeAfter(newNode, firstNode); Assert.Equal(value, ll.Head.Next.Value); Assert.Equal(ll.Head.Value, firstNode.Value); }
public void AddNodeAfterWhereSpecifiedNodeIsFalse(object value) { Node firstNode = new Node("First"); Node secondNode = new Node("Second"); Node thirdNode = new Node("Third"); Node randomNode = new Node("Nope"); LListDouble ll = new LListDouble(firstNode); ll.Add(secondNode); ll.Add(thirdNode); Node newNode = new Node(value); var IsSuccessful = ll.AddNodeAfter(newNode, randomNode); Assert.False(IsSuccessful); }
public void AddNodeAfterWhereSpecifiedNodeIsTrue(object value) { Node firstNode = new Node("First"); Node secondNode = new Node("Second"); Node thirdNode = new Node("Third"); LListDouble ll = new LListDouble(firstNode); ll.Add(secondNode); ll.Add(thirdNode); Node newNode = new Node(value); var IsSuccessful = ll.AddNodeAfter(newNode, secondNode); Assert.True(IsSuccessful); Assert.Equal(secondNode.Next, newNode); }
public void AddNodeAfterWhereSpecifiedNodeIsHeadAndNextIsNotNull(object value) { Node firstNode = new Node("First"); Node secondNode = new Node("Second"); LListDouble ll = new LListDouble(firstNode); ll.Add(secondNode); Assert.Equal("Second", ll.Head.Value); Node newNode = new Node(value); ll.AddNodeAfter(newNode, secondNode); Assert.Equal(value, ll.Head.Next.Value); Assert.Equal(ll.Head.Value, secondNode.Value); }