예제 #1
0
        public void TestIncert_ShouldThrowIndexOutOfRangeException()
        {
            // arrange
            int[]            arr         = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            IndexArray <int> index_array = new IndexArray <int>(3, arr);

            // act and assert
            Assert.Throws <IndexOutOfRangeException>(() => index_array.Insert(14, 5));
        }
예제 #2
0
        public void TestIncert()
        {
            // arrange
            int[]            arr         = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            int[]            expected    = new int[] { 1, 2, 3, 4, 5, 6, 100, 7, 8, 9 };
            IndexArray <int> index_array = new IndexArray <int>(-3, arr);

            // act
            index_array.Insert(2, 100);

            // assert
            Assert.Equal(expected, index_array);
        }