コード例 #1
0
        public void TestSetLast_Throws_Exception_When_Size_0()
        {
            LinkedList <Employee> linkedList = new LinkedList <Employee>();
            Employee emp1 = new Employee(1);

            Assert.That(() => linkedList.SetLast(emp1), Throws.Exception.TypeOf <IndexOutOfRangeException>());
        }
コード例 #2
0
        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));
        }