// 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)); }
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;"); }
public void SelectRow_WrongUsing() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, false)); Assert.IsNull(odd.SelectRow("SELECT f1 FROM WrongTable;")); Assert.IsNull(odd.SelectRow("SELECT f1 FROM TestTable UNION ALL SELECT f2 FROM TestTable;")); }
public void SelectRow() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, false)); Assert.IsNotNull(odd.SelectRow("SELECT f1 FROM TestTable;")); Assert.IsNotNull(odd.SelectRow("SELECT * FROM TestTable;", 0)); }
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 SelectTable_SelectTableUsingArguments() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, false)); Assert.AreEqual("a", odd.SelectTable("SELECT f1 FROM TestTable WHERE f1=@param;", new OleDbParameter("@param", 'a')).Rows[0].ItemArray[0]); Assert.IsNullOrEmpty(odd.LastOperationErrorMessage); }
public void SelectTable_SelectWholeTable() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, false)); Assert.IsNotNull(odd.SelectTable("SELECT * FROM TestTable;")); Assert.IsNullOrEmpty(odd.LastOperationErrorMessage); }
public void TestConnection_ConnectionStringIsNotDefined2() { OleDbQuery odd = new OleDbQuery(); Assert.IsFalse(odd.TestConnection("", true)); Assert.IsNotNullOrEmpty(odd.LastOperationErrorMessage); Assert.IsFalse(odd.IsConnectionIsActive); }
public void TestConnection_CanBeEstablished2() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, true)); Assert.That(connectionString, Is.EqualTo(odd.ConnectionString)); Assert.IsFalse(odd.IsConnectionIsActive); odd.Disconnect(); Assert.IsFalse(odd.IsConnectionIsActive); }
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 ChangeData_CreateTable() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString, true, false)); if (odd.SelectTable("SELECT * FROM test;") != null) { odd.ChangeData(sqlDropTestTable); } Assert.GreaterOrEqual(0, odd.ChangeData(sqlTestTableStatement)); Assert.IsNullOrEmpty(odd.LastOperationErrorMessage); }
public void TestConnection_CanBeEstablished1() { OleDbQuery odd = new OleDbQuery(); Assert.IsTrue(odd.TestConnection(connectionString)); }