Exemple #1
0
        public void InsertAt_Exception(int[] data, int number, int position)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            ll.InsertAt(number, position);
        }
Exemple #2
0
        public void InsertAt(int[] data, int number, int position, int[] expected)
        {
            var ll = new CrackingTheCodingInterview.DataStructures.LinkedLists.DoublyLinkedList <int>();

            foreach (var item in data)
            {
                ll.Add(item);
            }

            ll.InsertAt(number, position);

            Assert.AreEqual(expected.Length, ll.Count);
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], ll[i].value);
            }
        }