public void SelectCellTest <T>(T pExpectedValue, string sqlSelectStatement) { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.AreEqual(pExpectedValue, sqlite.SelectCell <T>(sqlSelectStatement)); }
public void SelectCell_WrongUsing3() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, true)); sqlite.SelectCell <bool>("SELECT f1,f2 FROM WrongTable;"); }
public void PutFileWrongUsage() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.IsFalse(sqlite.PutFile(Environment.CurrentDirectory + "\\TestDataStorage\\test_image_picture-128.png", "insert into test (f1, f4) values (@f1);", new SQLiteParameter("@f1", "file_test"))); }
public void PutFileNotExists() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.IsFalse(sqlite.PutFile(Environment.CurrentDirectory + "\\TestDataStorage\\not_exists_file.png", "insert into test (f1, f4) values (@f1, @file);", new SQLiteParameter("@f1", "file_test"))); }
public void SelectRow_WrongUsing() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.IsNull(sqlite.SelectRow("SELECT f1 FROM WrongTable;")); Assert.IsNull(sqlite.SelectRow("SELECT f1 FROM TestTable UNION ALL SELECT f1 FROM TestTable;")); }
public void SelectRow() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.IsNotNull(sqlite.SelectRow("SELECT f1 FROM TestTable;")); Assert.IsNotNull(sqlite.SelectRow("SELECT * FROM TestTable;", 0)); }
public void SelectCell_DefaultReturnValues() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.AreEqual(true, Convert.ToBoolean(sqlite.SelectCell <Int64>("SELECT f2 FROM TestTable;", 0))); Assert.AreEqual(true, sqlite.SelectCell <bool>("SELECT f999 FROM TestTable;", true)); }
public void SelectTable_SelectTableUsingArguments() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.AreEqual("text1", sqlite.SelectTable("SELECT f1 FROM TestTable WHERE f1=@param;", new SQLiteParameter("@param", "text1")).Rows[0].ItemArray[0]); Assert.IsNullOrEmpty(sqlite.LastOperationErrorMessage); }
public void SelectCell_DataTypes1() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, true)); Assert.AreEqual(DBNull.Value, sqlite.SelectCell <DBNull>("SELECT f4 FROM TestTable;")); Assert.AreEqual(DateTime.Now.ToString("dd.MM.yyyy"), Convert.ToDateTime(sqlite.SelectCell <string>("SELECT date('now');")).ToString("dd.MM.yyyy")); }
public void SelectTable_SelectWholeTable() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.IsNotNull(sqlite.SelectTable("SELECT * FROM TestTable;")); Assert.IsNullOrEmpty(sqlite.LastOperationErrorMessage); }
public void TestConnection_ConnectionStringIsNotDefined2() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsFalse(sqlite.TestConnection("", true)); Assert.IsNotNullOrEmpty(sqlite.LastOperationErrorMessage); Assert.IsFalse(sqlite.IsConnectionIsActive); }
public void GetImage() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Image image = sqlite.GetImage("select f4 from test where f1 = 'file_test' limit 1;"); Assert.IsNotNull(image); }
public void TestConnection_CanBeEstablished2() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, true)); Assert.That(connectionString, Is.EqualTo(sqlite.ConnectionString)); Assert.IsFalse(sqlite.IsConnectionIsActive); sqlite.Disconnect(); Assert.IsFalse(sqlite.IsConnectionIsActive); }
public void ChangeData_CreateTable() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); if (sqlite.SelectTable("SELECT * FROM test;") != null) { sqlite.ChangeData(sqlDropTestTable); } Assert.GreaterOrEqual(0, sqlite.ChangeData(sqlTestTableStatement)); Assert.IsNullOrEmpty(sqlite.LastOperationErrorMessage); }
public void PerformTransaction() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString, true, false)); Assert.AreEqual( sqlite.PerformTransaction(new SQLiteQueryStatement[] { new SQLiteQueryStatement() { QuerySql = "insert into test (f1) values (@v);", QueryParameters = new SQLiteParameter[] { new SQLiteParameter("@v", "transaction_test_1") } }, new SQLiteQueryStatement() { QuerySql = "insert into test (f1) values (@v);", QueryParameters = new SQLiteParameter[] { new SQLiteParameter("@v", "transaction_test_1") } } }), 2); }
public void TestConnection_CanBeEstablished1() { SQLite3Query sqlite = new SQLite3Query(); Assert.IsTrue(sqlite.TestConnection(connectionString)); }