Ejemplo n.º 1
0
        public void DeleteOneMiddleElement_ElementIsDeletedCorrectly_FromTail()
        {
            List <string> expected = new List <string> {
                "5", "4", "2", "1"
            };
            DoublyLinkedList <string> testList = new DoublyLinkedList <string>();

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

            testList.DeleteAtIndex(3);

            List <string> actual = CheckPreviousLinks(testList);

            CollectionAssert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void DeleteOneMiddleAndOneLastElements_ElementsAreDeletedCorrectly_FromHead()
        {
            List <string> expected = new List <string> {
                "1", "2", "4"
            };
            DoublyLinkedList <string> testList = new DoublyLinkedList <string>();

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

            testList.DeleteAtIndex(3);
            testList.DeleteAtIndex(4);

            List <string> actual = CheckNextLinks(testList);

            CollectionAssert.AreEqual(expected, actual);
        }