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 DictionaryIDataReaderNull() { var l = new DynamicLoader(); l.Dictionary((IDataReader)null); }
public void DictionaryDataSetNull() { var l = new DynamicLoader(); l.Dictionary((DataSet)null); }
public void DictionaryIDbCommandNull() { var l = new DynamicLoader(); l.Dictionary((IDbCommand)null); }