Example #1
0
        public void TestICollectionCopyTo()
        {
            int[]       array      = new int[2];
            ICollection collection = new HashCollection <int> {
                1, 2
            };

            collection.CopyTo(array, 0);
            Assert.IsTrue(array[0] == 1 || array[0] == 1);
            Assert.IsTrue(array[1] == 2 || array[1] == 2);

            array      = new[] { -1, -2, -3, -4, -5 };
            collection = new HashCollection <int> {
                1, 2
            };
            collection.CopyTo(array, 2);
            Assert.IsTrue(array[2] == 1 || array[3] == 1);
            Assert.IsTrue(array[2] == 2 || array[3] == 2);
            Assert.AreEqual(-1, array[0]);
            Assert.AreEqual(-2, array[1]);
            Assert.AreEqual(-5, array[4]);
        }