Пример #1
0
        public void Insert()
        {
            _tableMapCollection.AddRange(_tabs);
            DataTableMapping mymap = new DataTableMapping("sourceTestAge", "datatestSetAge");

            _tableMapCollection.Insert(3, mymap);
            int ind = _tableMapCollection.IndexOfDataSetTable("datatestSetAge");

            Assert.Equal(3, ind);
        }
Пример #2
0
        public void Insert()
        {
            var collection = new DataTableMappingCollection();

            Assert.Throws <ArgumentNullException>(() => collection.Insert(0, default(object)));
            Assert.Throws <ArgumentNullException>(() => collection.Insert(0, default(DataTableMapping)));
            Assert.Throws <InvalidCastException>(() => collection.Insert(0, "invalid"));
            object mapping = new DataTableMapping("source", "dataSet");

            Assert.Throws <ArgumentOutOfRangeException>(() => collection.Insert(-1, mapping));
            Assert.Throws <ArgumentOutOfRangeException>(() => collection.Insert(1, mapping));
            collection.Insert(0, mapping);
            Assert.Single(collection);
            Assert.Same(mapping, collection[0]);
            Assert.Throws <ArgumentException>(() => collection.Insert(1, mapping));
        }