public void AddNodeBeforeWhereSpecifiedNodeIsHead(object value) { Node firstNode = new Node("First"); LListDouble ll = new LListDouble(firstNode); Assert.Equal("First", ll.Head.Value); Node newNode = new Node(value); ll.AddNodeBefore(newNode, firstNode); Assert.Equal(value, ll.Head.Value); }
public void AddNodeBeforeWhereSpecifiedNodeIsTrue(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.AddNodeBefore(newNode, firstNode); Assert.True(IsSuccessful); Assert.Equal(secondNode.Next, newNode); }
public void AddNodeBeforeWhereSpecifiedNodeIsFalse(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.AddNodeBefore(newNode, randomNode); Assert.False(IsSuccessful); }