public async Task DataTableDictionaries()
        {
            using (var con = new SqlConnection(connectionString))
            {
                var sproc = new dboSelectMultipleStatement();

                var cmd = sproc.Build(con);

                var loader = new DynamicLoader();
                await con.OpenAsync();
                var adapter = new SqlDataAdapter(cmd);

                var ds = new DataSet();
                adapter.Fill(ds);
                var objs = loader.Dictionaries(ds.Tables[0]);

                Assert.IsNotNull(objs);

                var i = 0;
                foreach (var obj in objs)
                {
                    Assert.AreEqual(i, obj["Identifier"]);
                    i++;
                }
            }
        }
        public async Task DataTableDictionary()
        {
            using (var con = new SqlConnection(connectionString))
            {
                var sproc = SimulatedSelectStatement.Create();

                var cmd = sproc.Build(con);

                var loader = new DynamicLoader();
                await con.OpenAsync();
                var adapter = new SqlDataAdapter(cmd);

                var ds = new DataSet();
                adapter.Fill(ds);
                var table = ds.Tables[0];
                var obj = loader.Dictionary(table);

                Assert.IsNotNull(obj);
                Assert.AreEqual(sproc.TestInt, obj["Identifier"]);
                Assert.AreEqual(sproc.TestBigInt, obj["BigInt"]);
                Assert.AreEqual(sproc.TestBit, obj["Bit"]);
                Assert.AreEqual(sproc.TestDate.Value.Date, ((DateTime)obj["Date"]).Date);
                Assert.AreEqual(sproc.TestDateTime.Value.Date, ((DateTime)obj["DateTime"]).Date);
                Assert.AreEqual(sproc.TestDateTime2.Value.Date, ((DateTime)obj["DateTime2"]).Date);
                Assert.AreEqual(sproc.TestDecimal, obj["Decimal"]);
                Assert.AreEqual(sproc.TestFloat, obj["Float"]);
                Assert.AreEqual(Math.Round((decimal)sproc.TestMoney, 4), obj["Money"]);
                Assert.AreEqual(sproc.TestNChar, obj["NChar"]);
                Assert.AreEqual(sproc.TestNText, obj["NText"]);
                Assert.AreEqual(sproc.TestText, obj["Text"]);
                CollectionAssert.AreEqual(sproc.TestBinary, obj["Binary"] as byte[]);
                CollectionAssert.AreEqual(sproc.TestImage, obj["Image"] as byte[]);
                Assert.AreEqual(sproc.TestGuid, obj["Unique"]);
            }
        }
 public void DynamicDataSetNull()
 {
     var l = new DynamicLoader();
     l.Dynamic((DataSet)null);
 }
 public void DictionariesIDataReaderNull()
 {
     var l = new DynamicLoader();
     l.Dictionaries((IDataReader)null);
 }
 public void DictionariesDataSetNull()
 {
     var l = new DynamicLoader();
     l.Dictionaries((DataSet)null);
 }
 public void DictionaryDataTableNull()
 {
     var l = new DynamicLoader();
     l.Dictionary((DataTable)null);
 }
 public void DynamicIDbCommandNull()
 {
     var l = new DynamicLoader();
     l.Dynamic((IDbCommand)null);
 }
 public void DictionaryIDbCommandNull()
 {
     var l = new DynamicLoader();
     l.Dictionary((IDbCommand)null);
 }
 public void DynamicsIDataReaderNull()
 {
     var l = new DynamicLoader();
     l.Dynamics((IDataReader)null);
 }
        public async Task IDbCommandDynamics()
        {
            var sproc = new dboSelectMultipleStatement();
            var loader = new DynamicLoader();

            using (var con = new SqlConnection(connectionString))
            {
                var cmd = sproc.Build(con);

                await con.OpenAsync();
                var objs = loader.Dynamics(cmd);

                Assert.IsNotNull(objs);

                var i = 0;
                foreach (var obj in objs)
                {
                    Assert.AreEqual(i, obj.Identifier);
                    i++;
                }
            }
        }
        public async Task IDbCommandDynamic()
        {
            var loader = new DynamicLoader();
            var sproc = SimulatedSelectStatement.Create();

            using (var con = new SqlConnection(connectionString))
            {
                var cmd = sproc.Build(con);

                await con.OpenAsync();
                var obj = loader.Dynamic(cmd);

                Assert.IsNotNull(obj);
                Assert.AreEqual(sproc.TestInt, obj.Identifier);
                Assert.AreEqual(sproc.TestBigInt, obj.BigInt);
                Assert.AreEqual(sproc.TestBit, obj.Bit);
                Assert.AreEqual(sproc.TestDate.Value.Date, ((DateTime)obj.Date).Date);
                Assert.AreEqual(sproc.TestDateTime.Value.Date, ((DateTime)obj.DateTime).Date);
                Assert.AreEqual(sproc.TestDateTime2.Value.Date, ((DateTime)obj.DateTime2).Date);
                Assert.AreEqual(sproc.TestDecimal, obj.Decimal);
                Assert.AreEqual(sproc.TestFloat, obj.Float);
                Assert.AreEqual(Math.Round((decimal)sproc.TestMoney, 4), obj.Money);
                Assert.AreEqual(sproc.TestNChar, obj.NChar);
                Assert.AreEqual(sproc.TestNText, obj.NText);
                Assert.AreEqual(sproc.TestText, obj.Text);
                CollectionAssert.AreEqual(sproc.TestBinary, obj.Binary as byte[]);
                CollectionAssert.AreEqual(sproc.TestImage, obj.Image as byte[]);
                Assert.AreEqual(sproc.TestGuid, obj.Unique);
            }
        }
        public async Task DataReaderDictionaries()
        {
            using (var con = new SqlConnection(connectionString))
            {
                var sproc = new dboSelectMultipleStatement();

                var cmd = sproc.Build(con);

                var loader = new DynamicLoader();
                await con.OpenAsync();

                var reader = await cmd.ExecuteReaderAsync();
                var objs = loader.Dictionaries(reader);

                Assert.IsNotNull(objs);

                var i = 0;
                foreach (var obj in objs)
                {
                    Assert.AreEqual(i, obj["Identifier"]);
                    i++;
                }
            }
        }