Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
Loading...
Searching...
No Matches
database::testing::expectation_builder Class Reference

Fluent builder for expectations. More...

#include <mock_expectations.h>

Collaboration diagram for database::testing::expectation_builder:
Collaboration graph

Public Member Functions

 expectation_builder (mock_database *db, expectation exp)
 
expectation_builderwill_return (const core::database_result &result)
 
expectation_builderwill_return_rows (uint64_t count)
 
expectation_builderwill_fail (const std::string &error_message)
 
expectation_builderwill_succeed ()
 
expectation_buildertimes (int count)
 
expectation_builderonce ()
 
expectation_builderany_times ()
 

Private Attributes

mock_databasedb_
 
expectation exp_
 

Detailed Description

Fluent builder for expectations.

Definition at line 89 of file mock_expectations.h.

Constructor & Destructor Documentation

◆ expectation_builder()

database::testing::expectation_builder::expectation_builder ( mock_database * db,
expectation exp )

Definition at line 136 of file mock_expectations.cpp.

137 : db_(db), exp_(std::move(exp))
138{
139}

Member Function Documentation

◆ any_times()

expectation_builder & database::testing::expectation_builder::any_times ( )

Definition at line 175 of file mock_expectations.cpp.

175 {
176 exp_.at_least(0);
177 return *this;
178}
expectation & at_least(int count)

References database::testing::expectation::at_least(), and exp_.

Here is the call graph for this function:

◆ once()

expectation_builder & database::testing::expectation_builder::once ( )

Definition at line 170 of file mock_expectations.cpp.

170 {
171 exp_.once();
172 return *this;
173}

References exp_, and database::testing::expectation::once().

Here is the call graph for this function:

◆ times()

expectation_builder & database::testing::expectation_builder::times ( int count)

Definition at line 165 of file mock_expectations.cpp.

165 {
166 exp_.times(count);
167 return *this;
168}
expectation & times(int count)

References exp_, and database::testing::expectation::times().

Here is the call graph for this function:

◆ will_fail()

expectation_builder & database::testing::expectation_builder::will_fail ( const std::string & error_message)

Definition at line 153 of file mock_expectations.cpp.

153 {
154 exp_.throwing(error_message);
155 db_->expectations_.push_back(exp_);
156 return *this;
157}
expectation & throwing(const std::string &error_message)
std::vector< expectation > expectations_

References db_, exp_, database::testing::mock_database::expectations_, and database::testing::expectation::throwing().

Referenced by database::testing::mock_database_builder::failing_database().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ will_return()

expectation_builder & database::testing::expectation_builder::will_return ( const core::database_result & result)

Definition at line 141 of file mock_expectations.cpp.

141 {
142 exp_.returning(result);
143 db_->expectations_.push_back(exp_);
144 return *this;
145}
expectation & returning(const core::database_result &result)

References db_, exp_, database::testing::mock_database::expectations_, and database::testing::expectation::returning().

Referenced by database::testing::mock_database_builder::with_data().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ will_return_rows()

expectation_builder & database::testing::expectation_builder::will_return_rows ( uint64_t count)

Definition at line 147 of file mock_expectations.cpp.

147 {
149 db_->expectations_.push_back(exp_);
150 return *this;
151}
expectation & returning_rows_affected(uint64_t count)

References db_, exp_, database::testing::mock_database::expectations_, and database::testing::expectation::returning_rows_affected().

Here is the call graph for this function:

◆ will_succeed()

expectation_builder & database::testing::expectation_builder::will_succeed ( )

Definition at line 159 of file mock_expectations.cpp.

159 {
161 db_->expectations_.push_back(exp_);
162 return *this;
163}
expectation & returning_execute_result(bool result)

References db_, exp_, database::testing::mock_database::expectations_, and database::testing::expectation::returning_execute_result().

Here is the call graph for this function:

Member Data Documentation

◆ db_

mock_database* database::testing::expectation_builder::db_
private

Definition at line 105 of file mock_expectations.h.

Referenced by will_fail(), will_return(), will_return_rows(), and will_succeed().

◆ exp_

expectation database::testing::expectation_builder::exp_
private

The documentation for this class was generated from the following files: