diff --git a/tests/MockDb.h b/tests/MockDb.h index 1da2d555..91ab34d0 100644 --- a/tests/MockDb.h +++ b/tests/MockDb.h @@ -35,6 +35,11 @@ #include #include +// an object to store internal Mock flags and values to validate in tests +struct InternalMockData { + sqlpp::isolation_level _last_isolation_level; +}; + template struct MockDbT : public sqlpp::connection { @@ -248,7 +253,8 @@ struct MockDbT : public sqlpp::connection void start_transaction(sqlpp::isolation_level level) { - _current_isolation_level = level; + // store temporarily to verify the expected level was used in testcases + _mock_data._last_isolation_level = level; } void rollback_transaction(bool) @@ -260,7 +266,7 @@ struct MockDbT : public sqlpp::connection void report_rollback_failure(std::string) {} - sqlpp::isolation_level _current_isolation_level; + InternalMockData _mock_data; }; using MockDb = MockDbT; diff --git a/tests/Select.cpp b/tests/Select.cpp index 78b1daca..b475b642 100644 --- a/tests/Select.cpp +++ b/tests/Select.cpp @@ -184,7 +184,7 @@ int Select(int, char* []) } auto transaction = start_transaction(db, sqlpp::isolation_level::read_committed); - std::cout << (db._current_isolation_level == sqlpp::isolation_level::read_committed) << std::endl; + std::cout << (db._mock_data._last_isolation_level == sqlpp::isolation_level::read_committed) << std::endl; return 0; }