public void AddBefore_Value_Test_True_Int() { var list = new DoubleCircularLinkedList <int> { 1, 2, 4 }; Node <int> doi = list.First.Next; int trei = 3; list.AddAfter(doi, trei); Assert.Equal(3, list.Last.Previous.GetData()); }
public void AddAfter_ArgumentException_NodeToInsertAfter_Null_Test__Int() { var list = new DoubleCircularLinkedList <int>(); Node <int> nodeList = list.Last; Node <int> newNode = new Node <int>(1); var exception = Assert.Throws <ArgumentException>(() => list.AddAfter(nodeList, newNode)); Assert.Equal("Node to insert after is null", exception.Message); }
public void AddAfter_InvalidOperationException_NodeToInsert_Test__Int() { var list1 = new DoubleCircularLinkedList <int> { 1, 2, 3, 5 }; var list2 = new DoubleCircularLinkedList <int> { 1, 2, 3, 4 }; Node <int> nodeList1 = list1.Last.Previous; Node <int> nodeList2 = list2.Last; var exception = Assert.Throws <InvalidOperationException>(() => list1.AddAfter(nodeList1, nodeList2)); Assert.Equal("Node to insert is member of another list", exception.Message); }