|
Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
|
Single query expectation with configurable behavior. More...
#include <mock_expectations.h>

Public Member Functions | |
| expectation () | |
| expectation & | for_query (const std::string &query, match_type type=match_type::EXACT) |
| expectation & | for_pattern (const std::string &pattern) |
| expectation & | for_any () |
| expectation & | returning (const core::database_result &result) |
| expectation & | returning_rows_affected (uint64_t count) |
| expectation & | throwing (const std::string &error_message) |
| expectation & | returning_execute_result (bool result) |
| expectation & | times (int count) |
| expectation & | at_least (int count) |
| expectation & | at_most (int count) |
| expectation & | once () |
| expectation & | never () |
| bool | matches (const std::string &query) const |
| bool | is_satisfied () const |
| bool | can_be_invoked () const |
| core::database_result | get_result () |
| uint64_t | get_rows_affected () |
| bool | get_execute_result () |
| bool | should_throw () const |
| std::string | get_error_message () const |
Private Attributes | |
| std::string | query_ |
| match_type | match_type_ |
| std::regex | pattern_ |
| std::optional< core::database_result > | result_ |
| std::optional< uint64_t > | rows_affected_ |
| std::optional< bool > | execute_result_ |
| std::optional< std::string > | error_message_ |
| int | min_invocations_ |
| int | max_invocations_ |
| int | actual_invocations_ |
Single query expectation with configurable behavior.
Definition at line 34 of file mock_expectations.h.
| database::testing::expectation::expectation | ( | ) |
Definition at line 12 of file mock_expectations.cpp.
| expectation & database::testing::expectation::at_least | ( | int | count | ) |
Definition at line 64 of file mock_expectations.cpp.
References min_invocations_.
Referenced by database::testing::expectation_builder::any_times().

| expectation & database::testing::expectation::at_most | ( | int | count | ) |
Definition at line 69 of file mock_expectations.cpp.
References max_invocations_.
| bool database::testing::expectation::can_be_invoked | ( | ) | const |
Definition at line 99 of file mock_expectations.cpp.
References actual_invocations_, and max_invocations_.
| expectation & database::testing::expectation::for_any | ( | ) |
Definition at line 33 of file mock_expectations.cpp.
References database::testing::ANY, and match_type_.
Referenced by database::testing::mock_database::expect_any().

| expectation & database::testing::expectation::for_pattern | ( | const std::string & | pattern | ) |
Definition at line 29 of file mock_expectations.cpp.
References for_query(), and database::testing::PATTERN.
Referenced by database::testing::mock_database::expect_pattern().


| expectation & database::testing::expectation::for_query | ( | const std::string & | query, |
| match_type | type = match_type::EXACT ) |
Definition at line 20 of file mock_expectations.cpp.
References match_type_, database::testing::PATTERN, pattern_, and query_.
Referenced by database::testing::mock_database::expect_query(), and for_pattern().

| std::string database::testing::expectation::get_error_message | ( | ) | const |
Definition at line 131 of file mock_expectations.cpp.
References error_message_.
| bool database::testing::expectation::get_execute_result | ( | ) |
Definition at line 119 of file mock_expectations.cpp.
References actual_invocations_, error_message_, and execute_result_.
| core::database_result database::testing::expectation::get_result | ( | ) |
Definition at line 103 of file mock_expectations.cpp.
References actual_invocations_, error_message_, and result_.
| uint64_t database::testing::expectation::get_rows_affected | ( | ) |
Definition at line 111 of file mock_expectations.cpp.
References actual_invocations_, error_message_, and rows_affected_.
| bool database::testing::expectation::is_satisfied | ( | ) | const |
Definition at line 95 of file mock_expectations.cpp.
References actual_invocations_, and min_invocations_.
| bool database::testing::expectation::matches | ( | const std::string & | query | ) | const |
Definition at line 82 of file mock_expectations.cpp.
References database::testing::ANY, database::testing::EXACT, match_type_, database::testing::PATTERN, pattern_, and query_.
| expectation & database::testing::expectation::never | ( | ) |
Definition at line 78 of file mock_expectations.cpp.
References times().

| expectation & database::testing::expectation::once | ( | ) |
Definition at line 74 of file mock_expectations.cpp.
References times().
Referenced by database::testing::expectation_builder::once().


| expectation & database::testing::expectation::returning | ( | const core::database_result & | result | ) |
Definition at line 38 of file mock_expectations.cpp.
References result_.
Referenced by database::testing::expectation_builder::will_return().

| expectation & database::testing::expectation::returning_execute_result | ( | bool | result | ) |
Definition at line 53 of file mock_expectations.cpp.
References execute_result_.
Referenced by database::testing::expectation_builder::will_succeed().

| expectation & database::testing::expectation::returning_rows_affected | ( | uint64_t | count | ) |
Definition at line 43 of file mock_expectations.cpp.
References rows_affected_.
Referenced by database::testing::expectation_builder::will_return_rows().

| bool database::testing::expectation::should_throw | ( | ) | const |
Definition at line 127 of file mock_expectations.cpp.
References error_message_.
| expectation & database::testing::expectation::throwing | ( | const std::string & | error_message | ) |
Definition at line 48 of file mock_expectations.cpp.
References error_message_.
Referenced by database::testing::expectation_builder::will_fail().

| expectation & database::testing::expectation::times | ( | int | count | ) |
Definition at line 58 of file mock_expectations.cpp.
References max_invocations_, and min_invocations_.
Referenced by never(), once(), and database::testing::expectation_builder::times().

|
private |
Definition at line 82 of file mock_expectations.h.
Referenced by can_be_invoked(), get_execute_result(), get_result(), get_rows_affected(), and is_satisfied().
|
private |
Definition at line 78 of file mock_expectations.h.
Referenced by get_error_message(), get_execute_result(), get_result(), get_rows_affected(), should_throw(), and throwing().
|
private |
Definition at line 77 of file mock_expectations.h.
Referenced by get_execute_result(), and returning_execute_result().
|
private |
Definition at line 72 of file mock_expectations.h.
Referenced by for_any(), for_query(), and matches().
|
private |
Definition at line 81 of file mock_expectations.h.
Referenced by at_most(), can_be_invoked(), and times().
|
private |
Definition at line 80 of file mock_expectations.h.
Referenced by at_least(), is_satisfied(), and times().
|
private |
Definition at line 73 of file mock_expectations.h.
Referenced by for_query(), and matches().
|
private |
Definition at line 71 of file mock_expectations.h.
Referenced by for_query(), and matches().
|
private |
Definition at line 75 of file mock_expectations.h.
Referenced by get_result(), and returning().
|
private |
Definition at line 76 of file mock_expectations.h.
Referenced by get_rows_affected(), and returning_rows_affected().