15 , max_invocations_(std::numeric_limits<int>::max())
16 , actual_invocations_(0)
87 return std::regex_search(query,
pattern_);
137 : db_(db), exp_(std::move(exp))
Exception thrown by mock when simulating errors.
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.
std::vector< expectation > expectations_
std::vector< database_row > database_result
match_type
How to match query strings.
@ PATTERN
Regex pattern match.
@ EXACT
Exact string match.