Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function > Class Template Reference

#include <ExpectationDriver.h> [code]

List of all members.


Detailed Description

template<typename OwningCallDriver, typename Function>
class Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >

A thin wrapper around ExpectedFunction.

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 ()
ExpectationDrivernumberOfTimes (int from)
ExpectationDrivernumberOfTimes (int from, int to)

Private Attributes

OwningCallDriver & owningCallDriver
Function & expectedFunction


Member Typedef Documentation

template<typename OwningCallDriver, typename Function>
typedef Function::ReturnType Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::ReturnType
 

Definition at line 58 of file ExpectationDriver.h.


Constructor & Destructor Documentation

template<typename OwningCallDriver, typename Function>
Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::ExpectationDriver OwningCallDriver &  owningCallDriver_,
Function &  expectedFunction_
[inline]
 

Definition at line 60 of file ExpectationDriver.h.


Member Function Documentation

template<typename OwningCallDriver, typename Function>
ExpectationDriver& Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::numberOfTimes int  from,
int  to
[inline]
 

Definition at line 135 of file ExpectationDriver.h.

template<typename OwningCallDriver, typename Function>
ExpectationDriver& Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::numberOfTimes int  from  )  [inline]
 

Definition at line 129 of file ExpectationDriver.h.

template<typename OwningCallDriver, typename Function>
OwningCallDriver& Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::returns  )  [inline]
 

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.

template<typename OwningCallDriver, typename Function>
template<typename H, typename T>
DelayedCallDriver<ExpectationDriver, BoundFunction <H, T> > Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::willCall auto_ptr< BoundFunction< H, T > >  f  )  [inline]
 

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.

template<typename OwningCallDriver, typename Function>
template<typename H, typename T>
DelayedCallDriver<ExpectationDriver, BoundFunction <H, T> > Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::willCallMsg auto_ptr< BoundFunction< H, T > >  f,
const std::string &  expressionString,
const SourceLine &  sourceLine
[inline]
 

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.

template<typename OwningCallDriver, typename Function>
OwningCallDriver& Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::willReturn ReturnTypeWrapper< ReturnType r  )  [inline]
 

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.

template<typename OwningCallDriver, typename Function>
OwningCallDriver& Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::willReturnMsg ReturnTypeWrapper< ReturnType r,
const std::string &  ,
const SourceLine & 
[inline]
 

Definition at line 115 of file ExpectationDriver.h.


Member Data Documentation

template<typename OwningCallDriver, typename Function>
Function& Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::expectedFunction [private]
 

Definition at line 143 of file ExpectationDriver.h.

template<typename OwningCallDriver, typename Function>
OwningCallDriver& Utils::CalitkoMocks::ExpectationDriver< OwningCallDriver, Function >::owningCallDriver [private]
 

Definition at line 142 of file ExpectationDriver.h.


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