public void SelectCell_DefaultReturnValues() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, false)); Assert.AreEqual(true, odd.SelectCell <bool>("SELECT TOP 1 f14 FROM TestTable;", false)); Assert.AreEqual(true, odd.SelectCell <bool>("SELECT TOP 1 f999 FROM TestTable;", true)); }
public void SelectCell_DataTypes1() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, true)); Assert.AreEqual(Guid.Parse("{77E6E454-D883-4611-80B4-74AEE13F1C82}"), odd.SelectCell <Guid>("SELECT TOP 1 f9 FROM TestTable;")); Assert.AreEqual(DBNull.Value, odd.SelectCell <DBNull>("SELECT TOP 1 f10 FROM TestTable;")); // TODO: Replace DBNull.Value with real decimal(2,2) Assert.AreEqual(DateTime.Parse("21.11.2014").ToString("dd.MM.yyyy"), odd.SelectCell <DateTime>("SELECT TOP 1 f11 FROM TestTable;").ToString("dd.MM.yyyy")); Assert.AreEqual(string.Format("{0:c}", 100), string.Format("{0:c}", odd.SelectCell <decimal>("SELECT TOP 1 f12 FROM TestTable;"))); // TODO: Add longbinary testing // TODO: Add binary testing }
public void SelectCell_WrongUsing3() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, true)); odd.SelectCell <bool>("SELECT TOP 1 f1,f2 FROM WrongTable;"); }
// TODO: Add longbinary testing // TODO: Add binary testing public void SelectCellTest <T>(T pExpectedValue, string sqlSelectStatement) { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, false)); Assert.AreEqual(pExpectedValue, odd.SelectCell <T>(sqlSelectStatement)); }