Exemple #1
0
        public void CopyTo_IfArrayLengthTooSmallThrowException()
        {
            NewList <int> list = new NewList <int> {
                10, 20, 30, 40
            };

            int[] array = new int[] { 1, 2, 3, 4 };
            Assert.Throws <ArgumentOutOfRangeException>(() => list.CopyTo(array, 1));
        }
Exemple #2
0
        public void CopyTo_ListElementsAreInsertedAtTheBeginning()
        {
            NewList <int> list = new NewList <int> {
                10, 20, 30, 40
            };

            int[] array = new int[] { 1, 2, 3, 4, 5 };
            list.CopyTo(array, 0);
            int[] secondArray = new int[] { 10, 20, 30, 40, 5 };
            Assert.Equal(secondArray, array);
        }
Exemple #3
0
        public void CopyTo_ListElementsAreInsertedAtTheEnd()
        {
            NewList <int> list = new NewList <int> {
                10, 20, 30, 40, 50, 60, 70
            };

            int[] array = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            list.CopyTo(array, 2);
            int[] secondArray = new int[] { 1, 2, 10, 20, 30, 40, 50, 60, 70, 10 };
            Assert.Equal(secondArray, array);
        }