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

Private Attributes | |
| std::string | query_ |
| backend_match_type | match_type_ |
| std::regex | pattern_ |
| std::optional< core::database_result > | result_ |
| std::optional< uint64_t > | rows_affected_ |
| std::optional< std::string > | error_message_ |
| bool | execute_success_ |
| int | min_invocations_ |
| int | max_invocations_ |
| int | actual_invocations_ |
Single query expectation with configurable behavior for database_backend.
Unlike the legacy expectation class, this one works with Result<T> types for proper error handling.
Definition at line 37 of file mock_backend_expectations.h.
| database::testing::backend_expectation::backend_expectation | ( | ) |
Definition at line 11 of file mock_backend_expectations.cpp.
| backend_expectation & database::testing::backend_expectation::at_least | ( | int | count | ) |
Definition at line 65 of file mock_backend_expectations.cpp.
References min_invocations_.
Referenced by database::testing::backend_expectation_builder::any_times().

| backend_expectation & database::testing::backend_expectation::at_most | ( | int | count | ) |
Definition at line 70 of file mock_backend_expectations.cpp.
References max_invocations_.
| bool database::testing::backend_expectation::can_be_invoked | ( | ) | const |
Definition at line 100 of file mock_backend_expectations.cpp.
References actual_invocations_, and max_invocations_.
| backend_expectation & database::testing::backend_expectation::for_any | ( | ) |
Definition at line 33 of file mock_backend_expectations.cpp.
References database::testing::ANY, and match_type_.
Referenced by database::testing::mock_backend::expect_any().

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


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

| std::string database::testing::backend_expectation::get_error_message | ( | ) | const |
Definition at line 132 of file mock_backend_expectations.cpp.
References error_message_.
| kcenon::common::VoidResult database::testing::backend_expectation::get_execute_result | ( | ) |
Definition at line 120 of file mock_backend_expectations.cpp.
References actual_invocations_, and error_message_.
| kcenon::common::Result< uint64_t > database::testing::backend_expectation::get_rows_affected | ( | ) |
Definition at line 112 of file mock_backend_expectations.cpp.
References actual_invocations_, error_message_, and rows_affected_.
| kcenon::common::Result< core::database_result > database::testing::backend_expectation::get_select_result | ( | ) |
Definition at line 104 of file mock_backend_expectations.cpp.
References actual_invocations_, error_message_, and result_.
| bool database::testing::backend_expectation::is_satisfied | ( | ) | const |
Definition at line 96 of file mock_backend_expectations.cpp.
References actual_invocations_, and min_invocations_.
| bool database::testing::backend_expectation::matches | ( | const std::string & | query | ) | const |
Definition at line 83 of file mock_backend_expectations.cpp.
References database::testing::ANY, database::testing::EXACT, match_type_, database::testing::PATTERN, pattern_, and query_.
| backend_expectation & database::testing::backend_expectation::never | ( | ) |
Definition at line 79 of file mock_backend_expectations.cpp.
References times().

| backend_expectation & database::testing::backend_expectation::once | ( | ) |
Definition at line 75 of file mock_backend_expectations.cpp.
References times().
Referenced by database::testing::backend_expectation_builder::once().


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

| backend_expectation & database::testing::backend_expectation::returning_error | ( | const std::string & | error_message | ) |
Definition at line 48 of file mock_backend_expectations.cpp.
References error_message_.
Referenced by database::testing::backend_expectation_builder::will_fail().

| backend_expectation & database::testing::backend_expectation::returning_execute_success | ( | ) |
Definition at line 53 of file mock_backend_expectations.cpp.
References error_message_, and execute_success_.
Referenced by database::testing::backend_expectation_builder::will_succeed().

| backend_expectation & database::testing::backend_expectation::returning_rows_affected | ( | uint64_t | count | ) |
Definition at line 43 of file mock_backend_expectations.cpp.
References rows_affected_.
Referenced by database::testing::backend_expectation_builder::will_return_rows().

| bool database::testing::backend_expectation::should_error | ( | ) | const |
Definition at line 128 of file mock_backend_expectations.cpp.
References error_message_.
| backend_expectation & database::testing::backend_expectation::times | ( | int | count | ) |
Definition at line 59 of file mock_backend_expectations.cpp.
References max_invocations_, and min_invocations_.
Referenced by never(), once(), and database::testing::backend_expectation_builder::times().

|
private |
Definition at line 85 of file mock_backend_expectations.h.
Referenced by can_be_invoked(), get_execute_result(), get_rows_affected(), get_select_result(), and is_satisfied().
|
private |
Definition at line 80 of file mock_backend_expectations.h.
Referenced by get_error_message(), get_execute_result(), get_rows_affected(), get_select_result(), returning_error(), returning_execute_success(), and should_error().
|
private |
Definition at line 81 of file mock_backend_expectations.h.
Referenced by returning_execute_success().
|
private |
Definition at line 75 of file mock_backend_expectations.h.
Referenced by for_any(), for_query(), and matches().
|
private |
Definition at line 84 of file mock_backend_expectations.h.
Referenced by at_most(), can_be_invoked(), and times().
|
private |
Definition at line 83 of file mock_backend_expectations.h.
Referenced by at_least(), is_satisfied(), and times().
|
private |
Definition at line 76 of file mock_backend_expectations.h.
Referenced by for_query(), and matches().
|
private |
Definition at line 74 of file mock_backend_expectations.h.
Referenced by for_query(), and matches().
|
private |
Definition at line 78 of file mock_backend_expectations.h.
Referenced by get_select_result(), and returning().
|
private |
Definition at line 79 of file mock_backend_expectations.h.
Referenced by get_rows_affected(), and returning_rows_affected().