#include <ExpectationDriver.h> [code]
This class is used as a helper to build a tree of BoundFunction and ExpecedFunction objects and thus model an interaction between a object of the class being tested (represented by a test driver class) and its environment (represented by objects of mock classes). ExpectationDriver, as well as CallDriver and DelayedCallDriver manipulate the underlying BoundFunction and ExpectedFunction objects and their functions return objects or object references to each other depending on the context.
ExpectationDriver objects are supposed to be created by CallDriver objects. That happens when an ExpectedFunction needs to be configured and attached to a BoundFunction managed by CallDriver. When a call back to the object under test needs to be modelled from the environment, before an ExpectedFunction returns a stubbed value, a DelayedCallDriver is created and returned by the ExpectationDriver. Thus the contexts are switched. Contexts are switched back using the willReturn() or willReturnVoid() functions.
Definition at line 55 of file ExpectationDriver.h.
Public Types | |
| typedef Function::ReturnType | ReturnType |
Public Member Functions | |
| ExpectationDriver (OwningCallDriver &owningCallDriver_, Function &expectedFunction_) | |
| template<typename H, typename T> | |
| DelayedCallDriver< ExpectationDriver, BoundFunction< H, T > > | willCall (auto_ptr< BoundFunction< H, T > > f) |
| Model a call back to the tested object from an expected call on a mock. | |
| template<typename H, typename T> | |
| DelayedCallDriver< ExpectationDriver, BoundFunction< H, T > > | willCallMsg (auto_ptr< BoundFunction< H, T > > f, const std::string &expressionString, const SourceLine &sourceLine) |
| OwningCallDriver & | willReturn (ReturnTypeWrapper< ReturnType > r) |
| Express the expectation for the return or stub the return value. | |
| OwningCallDriver & | willReturnMsg (ReturnTypeWrapper< ReturnType > r, const std::string &, const SourceLine &) |
| OwningCallDriver & | returns () |
| ExpectationDriver & | numberOfTimes (int from) |
| ExpectationDriver & | numberOfTimes (int from, int to) |
Private Attributes | |
| OwningCallDriver & | owningCallDriver |
| Function & | expectedFunction |
|
|||||
|
Definition at line 58 of file ExpectationDriver.h. |
|
||||||||||||||||
|
Definition at line 60 of file ExpectationDriver.h. |
|
||||||||||||||||
|
Definition at line 135 of file ExpectationDriver.h. |
|
||||||||||
|
Definition at line 129 of file ExpectationDriver.h. |
|
|||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 124 of file ExpectationDriver.h. |
|
||||||||||||||
|
Model a call back to the tested object from an expected call on a mock. Use this function if you want to model a call back to the test object from a (expectation) function of a mock. If the expectatio is fulfilled, then all functions selected using this function will be executed and their return values, if any, will be checked. Definition at line 76 of file ExpectationDriver.h. |
|
||||||||||||||||||||||||
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 91 of file ExpectationDriver.h. |
|
||||||||||
|
Express the expectation for the return or stub the return value. This function allows you to stub the return value of the mocked function call (expectation). Definition at line 104 of file ExpectationDriver.h. |
|
||||||||||||||||||||
|
Definition at line 115 of file ExpectationDriver.h. |
|
|||||
|
Definition at line 143 of file ExpectationDriver.h. |
|
|||||
|
Definition at line 142 of file ExpectationDriver.h. |