Example #1
0
        public void CopyTo_TestMethod_1()
        {
            int[] arr1 = { 1, 1 };
            foreach (int val in arr1)
            {
                list.Add(val);
            }

            int[] arr2 = { 2, 2, 2, 2, 2, 2, 2 };

            list.CopyTo(arr2, 3);
            Assert.AreEqual(1, arr2[3]);
            Assert.AreEqual(1, arr2[4]);
        }
Example #2
0
        public void CopyToNullTestMethod()
        {
            int[]             array = null;
            MyListArray <int> list  = new MyListArray <int>(1);

            list.Add(100);
            list.CopyTo(array, 2);
        }
Example #3
0
        public void CopyToArgExeptionTestMethod()
        {
            int[]             array = new int[5];
            MyListArray <int> list  = new MyListArray <int>(2);

            list.Add(100);
            list.Add(101);
            list.CopyTo(array, 4);
        }
Example #4
0
        public void CopyToOutOfRangeTestMethod()
        {
            int[]             array = new int[5];
            MyListArray <int> list  = new MyListArray <int>(2);

            list.Add(100);
            list.Add(101);
            list.CopyTo(array, -1);
        }
Example #5
0
        public void CopyToTestMethod()
        {
            int[] array = new int[5] {
                9, 8, 7, 6, 5
            };
            MyListArray <int> list = new MyListArray <int>(3);

            list.Add(100);
            list.Add(101);
            list.Add(102);
            list.CopyTo(array, 2);
            Assert.AreEqual(9, array[0]);
            Assert.AreEqual(8, array[1]);
            Assert.AreEqual(list[0], array[2]);
            Assert.AreEqual(list[1], array[3]);
            Assert.AreEqual(list[2], array[4]);
        }