Ejemplo n.º 1
0
        public void AddAtIndex_10()
        {
            var exp         = new MyList(new int[] { 4, 6, 2, 8, 10 });
            var currentList = new MyList(new int[] { 4, 6, 8, 10 });

            currentList.AddAtIndex(2, 2);
            Assert.AreEqual(exp, currentList);
        }
Ejemplo n.º 2
0
        public void AddAtIndexTest()
        {
            // Arrange
            var list = new MyList <int>();

            // Act
            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.AddAtIndex(2, 7);

            // Assert
            Assert.AreEqual(1, list[0]);
            Assert.AreEqual(2, list[1]);
            Assert.AreEqual(7, list[2]);
            Assert.AreEqual(3, list[3]);
            Assert.AreEqual(4, list[4]);
            Assert.AreEqual(5, list.Length);
            Assert.AreEqual(8, list.Capacity);
        }