예제 #1
0
        public void CantCopyToArrayOfSmallerSize()
        {
            var list = new ChunkedList <int>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(i);
            }

            var arr = new int[5];

            Trap.Exception(() => list.CopyTo(arr, 0)).ShouldBeInstanceOf <ArgumentOutOfRangeException>();
        }
예제 #2
0
        public void CanCopyToArrayFromIndex()
        {
            var list = new ChunkedList <int>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(i);
            }

            var arr = new int[20];

            list.CopyTo(arr, 10);

            for (int i = 10; i < 20; i++)
            {
                arr[i].ShouldEqual(i - 10);
            }
        }
예제 #3
0
        public void CanCopyToArray()
        {
            var list = new ChunkedList <int>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(i);
            }

            var arr = new int[10];

            list.CopyTo(arr, 0);

            for (int i = 0; i < 10; i++)
            {
                arr[i].ShouldEqual(i);
            }
        }