Example #1
0
        public void DListInsertTest()
        {
            int[]       arr  = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            DList <int> list = new DList <int>(arr);

            list.Insert(0, 100);
            Assert.AreEqual(11, list.Count);
            Assert.AreEqual(100, list[0]);
            Assert.AreEqual(1, list[1]);
            list.Insert(10, 1000);
            Assert.AreEqual(12, list.Count);
            Assert.AreEqual(1000, list[10]);
            Assert.AreEqual(10, list[11]);
        }
Example #2
0
        public void Insert()
        {
            var list = new DList <int> {
                1, 3
            };

            list.Insert(1, 2);

            list.ShouldBe(new[] { 1, 2, 3 });
        }