public void TestGetLast_When_List_Greater_Than_0() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); linkedList.Add(emp1); linkedList.Add(emp2); Assert.That(linkedList.GetLast(), Is.EqualTo(emp1)); }
public void TestSetLast_Success() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.InsertData(emp1); linkedList.InsertData(emp2); linkedList.SetLast(emp3); Assert.That(linkedList.GetLast(), Is.EqualTo(emp3)); }
public void TestAddAfter_Node_Is_Tail() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.InsertData(emp1); linkedList.InsertData(emp2); linkedList.AddAfter(emp3, emp2); Assert.That(linkedList.GetLast(), Is.EqualTo(emp3)); }
public void TestSet_Position_Equals_Size() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.Add(emp2); linkedList.Add(emp1); linkedList.Set(emp3, 2); Assert.That(linkedList.GetLast(), Is.EqualTo(emp3)); }
public void TestInsertData_LinkTail_When_Data_Is_At_The_End() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.Add(emp2); linkedList.Add(emp1); linkedList.InsertData(emp3); Assert.That(linkedList.GetLast(), Is.EqualTo(emp3)); }
public void TestInsertData_Link_Method_Works_Correctly() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.Add(emp3); linkedList.Add(emp1); linkedList.InsertData(emp2); Assert.That(linkedList.GetLast(), Is.EqualTo(emp3)); }
public void TestRemove_Position_Equals_Size() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.InsertData(emp1); linkedList.InsertData(emp2); linkedList.InsertData(emp3); linkedList.Remove(3); Assert.That(linkedList.GetLast(), Is.EqualTo(emp2)); }
public void TestRemoveLast_Tail_Properly_Replaced() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.Add(emp1); linkedList.Add(emp2); linkedList.Add(emp3); linkedList.RemoveLast(); Assert.That(linkedList.GetLast(), Is.EqualTo(emp2)); }
public void TestGetLast_Throws_Exception_When_Empty() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Assert.That(() => linkedList.GetLast(), Throws.Exception.TypeOf <IndexOutOfRangeException>()); }