57 bool matches(
const std::string& query)
const;
75 std::optional<core::database_result>
result_;
116 : std::runtime_error(message) {}
Exception thrown by mock when simulating errors.
database_exception(const std::string &message)
Fluent builder for expectations.
expectation_builder & will_return(const core::database_result &result)
expectation_builder & will_succeed()
expectation_builder & any_times()
expectation_builder & once()
expectation_builder & times(int count)
expectation_builder & will_fail(const std::string &error_message)
expectation_builder(mock_database *db, expectation exp)
expectation_builder & will_return_rows(uint64_t count)
Single query expectation with configurable behavior.
expectation & throwing(const std::string &error_message)
std::string get_error_message() const
expectation & returning(const core::database_result &result)
std::optional< uint64_t > rows_affected_
core::database_result get_result()
bool can_be_invoked() const
expectation & returning_rows_affected(uint64_t count)
expectation & at_least(int count)
expectation & at_most(int count)
bool should_throw() const
uint64_t get_rows_affected()
std::optional< std::string > error_message_
bool matches(const std::string &query) const
bool get_execute_result()
expectation & for_pattern(const std::string &pattern)
bool is_satisfied() const
expectation & returning_execute_result(bool result)
expectation & for_query(const std::string &query, match_type type=match_type::EXACT)
std::optional< bool > execute_result_
std::optional< core::database_result > result_
expectation & times(int count)
Configurable mock for database_backend interface.
Abstract interface for database backends.
std::vector< database_row > database_result
match_type
How to match query strings.
@ EXACT
Exact string match.
@ PATTERN
Regex pattern match.
@ EXACT
Exact string match.