public void TestGetData_Returns_Proper_Data() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); linkedList.InsertData(emp1); linkedList.InsertData(emp2); Assert.That(linkedList.Get(emp1), Is.EqualTo(emp1)); }
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 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 TestAddBefore_Node_Is_Head() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); linkedList.InsertData(emp2); linkedList.InsertData(emp3); linkedList.AddBefore(emp1, emp2); Assert.That(linkedList.GetFirst(), Is.EqualTo(emp1)); }
public void TestAddBefore_Throw_Exception_When_Null() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); Employee emp4 = new Employee(4); linkedList.InsertData(emp1); linkedList.InsertData(emp2); Assert.That(() => linkedList.AddBefore(emp3, emp4), Throws.Exception.TypeOf <IndexOutOfRangeException>()); }
public void TestSet_Data_OldData_Returns_Correct_Data() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); Employee emp4 = new Employee(4); linkedList.InsertData(emp1); linkedList.InsertData(emp3); linkedList.InsertData(emp4); Assert.That(linkedList.Set(emp2, emp3), 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 TestSet_Data_OldData_Replaces_Node() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); Employee emp4 = new Employee(4); linkedList.InsertData(emp1); linkedList.InsertData(emp3); linkedList.InsertData(emp4); linkedList.Set(emp2, emp3); Assert.That(linkedList.Get(2), Is.EqualTo(emp2)); }
public void TestAddBefore_Node_Is_In_The_Middle_Of_The_List() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); Employee emp4 = new Employee(4); linkedList.InsertData(emp1); linkedList.InsertData(emp2); linkedList.InsertData(emp4); linkedList.AddBefore(emp3, emp4); Assert.That(linkedList.Get(3), Is.EqualTo(emp3)); }
public void TestRemove_Position_Returns_Correct_Data() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); Employee emp4 = new Employee(4); linkedList.InsertData(emp1); linkedList.InsertData(emp2); linkedList.InsertData(emp3); linkedList.InsertData(emp4); Assert.That(linkedList.Remove(2), Is.EqualTo(emp2)); }
public void TestSet_Position_In_Middle_Of_List() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); Employee emp3 = new Employee(3); Employee emp4 = new Employee(4); linkedList.InsertData(emp1); linkedList.InsertData(emp2); linkedList.InsertData(emp3); linkedList.Set(emp4, 2); Assert.That(linkedList.Get(2), Is.EqualTo(emp4)); }
public void TestInsertData_Linked_List_Size_0() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); linkedList.InsertData(emp1); Assert.That(linkedList.GetFirst(), Is.EqualTo(emp1)); }
public void TestGetData_Throws_Exception_When_Node_Is_Null() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); linkedList.InsertData(emp1); Assert.That(() => linkedList.Get(emp2), Throws.Exception.TypeOf <IndexOutOfRangeException>()); }
public void TestInsertData_Current_Data_Less_Than_Whats_In_List() { LinkedList <Employee> linkedList = new LinkedList <Employee>(); Employee emp1 = new Employee(1); Employee emp2 = new Employee(2); linkedList.Add(emp2); linkedList.InsertData(emp1); Assert.That(linkedList.GetFirst(), Is.EqualTo(emp1)); }
public void TestInsertData_Current_Data_Inserted_Middle_Of_List() { 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.Get(2), Is.EqualTo(emp2)); }
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)); }