Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        public void TestSetFirst_Success()
        {
            LinkedList <Employee> linkedList = new LinkedList <Employee>();
            Employee emp1 = new Employee(1);
            Employee emp2 = new Employee(2);

            linkedList.InsertData(emp1);

            linkedList.SetFirst(emp2);
            Assert.That(linkedList.GetFirst(), Is.EqualTo(emp2));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        public void TestGetFirst()
        {
            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.GetFirst(), Is.EqualTo(emp2));
        }
Esempio n. 5
0
        public void TestRemoveFirst_Head_Replaced()
        {
            LinkedList <Employee> linkedList = new LinkedList <Employee>();
            Employee emp1 = new Employee(1);
            Employee emp2 = new Employee(2);

            linkedList.Add(emp1);
            linkedList.Add(emp2);

            linkedList.RemoveFirst();
            Assert.That(linkedList.GetFirst(), Is.EqualTo(emp1));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        public void TestAddBefore_Position_Equals_1()
        {
            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(emp2);

            linkedList.AddBefore(emp1, 1);
            Assert.That(linkedList.GetFirst(), Is.EqualTo(emp1));
        }
Esempio n. 8
0
        public void TestRemove_Position_Equals_1()
        {
            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(1);
            Assert.That(linkedList.GetFirst(), Is.EqualTo(emp2));
        }
Esempio n. 9
0
 private void Reset()
 {
     current  = ourList.GetFirst();
     pervious = null;
 }