Пример #1
0
        public void CopyTo()
        {
            DataTableMapping[] tabcops = new DataTableMapping[5];
            _tableMapCollection.AddRange(_tabs);
            _tableMapCollection.CopyTo(tabcops, 0);
            bool eq;

            for (int i = 0; i < 5; i++)
            {
                eq = _tableMapCollection[i].Equals(tabcops[i]);
                Assert.True(eq);
            }
            tabcops = null;
            tabcops = new DataTableMapping[7];
            _tableMapCollection.CopyTo(tabcops, 2);
            for (int i = 0; i < 5; i++)
            {
                eq = _tableMapCollection[i].Equals(tabcops[i + 2]);
                Assert.True(eq);
            }
            eq = _tableMapCollection[0].Equals(tabcops[0]);
            Assert.False(eq);
            eq = _tableMapCollection[0].Equals(tabcops[1]);
            Assert.False(eq);
        }
        public void CopyTo()
        {
            DataTableMapping [] tabcops = new DataTableMapping[5];
            tableMapCollection.AddRange(tabs);
            tableMapCollection.CopyTo(tabcops, 0);
            bool eq;

            for (int i = 0; i < 5; i++)
            {
                eq = tableMapCollection[i].Equals(tabcops[i]);
                Assert.AreEqual(true, eq, "test1" + i);
            }
            tabcops = null;
            tabcops = new DataTableMapping[7];
            tableMapCollection.CopyTo(tabcops, 2);
            for (int i = 0; i < 5; i++)
            {
                eq = tableMapCollection[i].Equals(tabcops[i + 2]);
                Assert.AreEqual(true, eq, "test2" + i);
            }
            eq = tableMapCollection[0].Equals(tabcops[0]);
            Assert.AreEqual(false, eq, "test31");
            eq = tableMapCollection[0].Equals(tabcops[1]);
            Assert.AreEqual(false, eq, "test32");
        }
Пример #3
0
 // <Snippet1>
 public void PushIntoArray()
 {
     // ...
     // create DataTableMappingCollection collection mappings
     // ...
     DataTableMapping[] tables = {};
     mappings.CopyTo(tables, 0);
     mappings.Clear();
 }
Пример #4
0
        public void CopyToArray()
        {
            var mapping    = new DataTableMapping("source", "dataSet");
            var collection = new DataTableMappingCollection
            {
                mapping,
            };
            Array array = new DataTableMapping[1];

            collection.CopyTo(array, 0);
            Assert.Same(mapping, array.GetValue(0));
        }