Example #1
0
        public void AllMethodsTest(int[] inputArray, int[] expectedArray)
        {
            DoubleLinkedList expected = new DoubleLinkedList(expectedArray);
            DoubleLinkedList actual   = new DoubleLinkedList(inputArray);

            actual.Add(8);
            actual.AddAtFirstIndex(100);
            actual.AddAtIndex(20, 3);
            actual.Remove();
            actual.RemoveAtFirstIndex();
            actual.RemoveByIndex(1);
            actual.Add(9);
            actual.RemoveLastValues(3);
            actual.AddAtFirstIndex(100);
            actual.AddAtFirstIndex(25);
            actual.RemoveFirstValues(2);
            actual.AddListByIndex(new DoubleLinkedList(new int[] { 2, 3, 4, 5 }), 1);
            actual.RemoveValuesByIndex(5, 2);
            actual.Reverse();
            actual.SortAscending();
            actual.SortDescending();
            actual.AddList(new DoubleLinkedList(new int[] { 100, 200 }));
            actual.AddListAtBeginning(new DoubleLinkedList(new int[] { 99, 88, 77 }));
            actual.AddAtFirstIndex(100);
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void AddAtFirstIndexTest(int[] inputArray, int value, int[] expectedArray)
        {
            DoubleLinkedList expected = new DoubleLinkedList(expectedArray);
            DoubleLinkedList actual   = new DoubleLinkedList(inputArray);

            actual.AddAtFirstIndex(value);
            Assert.AreEqual(expected, actual);
        }