File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
2+ using System . Collections . Generic ;
3+
4+ namespace QueryDB . Core . Tests
5+ {
6+ [ TestClass ]
7+ public class QueryDBTests : TestBase
8+ {
9+
10+ #region Unknow DB Tests
11+
12+ [ TestMethod ]
13+ [ TestCategory ( DB_TESTS ) , TestCategory ( UNKNOW_DB_TESTS ) ]
14+ public void ExecuteCommand_UnknownDB_ReturnsNegativeOne ( )
15+ {
16+ string sqlStatement = "DELETE FROM users" ;
17+
18+ var dbContext = new DBContext ( ( DB ) 999 , "some_invalid_connection_string" ) ;
19+ var result = dbContext . ExecuteCommand ( sqlStatement ) ;
20+
21+ Assert . AreEqual ( - 1 , result ) ;
22+ }
23+
24+ [ TestMethod ]
25+ [ TestCategory ( DB_TESTS ) , TestCategory ( UNKNOW_DB_TESTS ) ]
26+ public void ExecuteTransaction_UnknownDB_ReturnsFalse ( )
27+ {
28+ var sqlStatements = new List < string >
29+ {
30+ "DELETE FROM users"
31+ } ;
32+
33+ var dbContext = new DBContext ( ( DB ) 999 , "some_invalid_connection_string" ) ;
34+ var result = dbContext . ExecuteTransaction ( sqlStatements ) ;
35+
36+ Assert . IsFalse ( result ) ;
37+ }
38+
39+ #endregion
40+
41+ }
42+ }
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public class TestBase
2020 protected const string ORACLE_TESTS = "ORACLE-TESTS" ;
2121 protected const string POSTGRESQL_TESTS = "POSTGRESQL-TESTS" ;
2222 protected const string QUERY_DB_EXCEPTION_TESTS = "QUERY-DB-EXCEPTION-TESTS" ;
23+ protected const string UNKNOW_DB_TESTS = "UNKNOW-DB-TESTS" ;
2324
2425 [ AssemblyInitialize ]
2526 internal void CheckDockerImages ( )
You can’t perform that action at this time.
0 commit comments