Example #1
0
        public void GetTheLastElementInEmptyList_OutOfRangeException()
        {
            DoublyLinkedList <string> testList = new DoublyLinkedList <string>();

            Assert.ThrowsException <IndexOutOfRangeException>(
                () => testList.LastElement());
        }
Example #2
0
        public void GetTheLastElement_TheRightElementIsGotten()
        {
            string expected = "5";
            DoublyLinkedList <string> testList = new DoublyLinkedList <string>("1", "2", "3", "4", "5");

            string actual = testList.LastElement();

            Xunit.Assert.Equal(expected, actual);
        }
Example #3
0
        public void GetTheLastElement_TheRightElementIsGotten()
        {
            string expected = "5";
            DoublyLinkedList <string> testList = new DoublyLinkedList <string>();

            testList.AddToTail("1");
            testList.AddToTail("2");
            testList.AddToTail("3");
            testList.AddToTail("4");
            testList.AddToTail("5");

            string actual = testList.LastElement();

            Assert.AreEqual(expected, actual);
        }