public void RemoveValue_Expect_ValueWasRemoved() { int valueToBeRemoved = 3; var linkedList = new WsLinkedList(); linkedList.InsertLast(2); linkedList.InsertLast(valueToBeRemoved); linkedList.Remove(valueToBeRemoved); var exists = linkedList.ToArray().Any(x => x == valueToBeRemoved); Assert.False(exists); }
public void LinkedListToArray_Expect_AllValuesIncluded() { var linkedList = new WsLinkedList(); linkedList.InsertLast(2); linkedList.InsertLast(3); linkedList.InsertFirst(6); var arr = linkedList.ToArray(); Assert.Equal(6, arr[0]); Assert.Equal(2, arr[1]); Assert.Equal(3, arr[2]); }
public void InsertNodeBeforeInMiddle_Expect_OrderPersisted() { var linkedList = new WsLinkedList(); linkedList.InsertFirst(2); linkedList.InsertFirst(3); linkedList.InsertBefore(2, 1); var arr = linkedList.ToArray(); Assert.Equal(3, arr[0]); Assert.Equal(1, arr[1]); Assert.Equal(2, arr[2]); }