mockpp::VisitableMockObjectBase Class Reference
[Advanced Mock Objects]

Base class for a generic object that can be used to replace a real world object for testing purposes. More...

Inheritance diagram for mockpp::VisitableMockObjectBase:
Inheritance graph
[legend]

List of all members.

Classes

class  Controller
 Virtual base class for helper objects to easily set up the expectations. More...

Public Member Functions

 VisitableMockObjectBase (const String &name, VerifiableList *parent)
 Construct the item.
virtual ~VisitableMockObjectBase ()
 Destruct the item.
void activate ()
 Changes from record mode to normal working mode so you can use the object.
void unsetThrowablesInline ()
 Switches exception handling back to pre-1.2 behaviour.
void addExpectedMethod (const std::string &name) const
 Adds another expected call to a mock method.
void addActualMethod (const std::string &name) const
 Adds another actual call to a mock method.
bool isActivated () const
 Get information about working mode.
void addController (Controller *pc)
 Adds another mock controller.
void removeController (Controller *pc)
 Removes a mock controller.
unsigned numController () const
 Gets the number of attached controllers.

Protected Member Functions

void visitableVerify ()
 Verify that the expected and actual values are equal.
void visitableReset ()
 Sets all internal objects to the state after construction.

Friends

class Controller

Detailed Description

Base class for a generic object that can be used to replace a real world object for testing purposes.

It emulates the real world behaviour by feeding it values and exceptions.

Definition at line 57 of file VisitableMockObject.h.


Constructor & Destructor Documentation

mockpp::VisitableMockObjectBase::VisitableMockObjectBase ( const String name,
VerifiableList parent 
)

Construct the item.

Parameters:
name human readable description about the object
parent parent verifiable

Definition at line 40 of file VisitableMockObject.cpp.


Member Function Documentation

void mockpp::VisitableMockObjectBase::addActualMethod ( const std::string &  name  )  const

Adds another actual call to a mock method.

Parameters:
name unique identifier for method

Definition at line 59 of file VisitableMockObject.cpp.

void mockpp::VisitableMockObjectBase::addController ( Controller pc  ) 

Adds another mock controller.

Parameters:
pc pointer to controller

Definition at line 101 of file VisitableMockObject.cpp.

void mockpp::VisitableMockObjectBase::addExpectedMethod ( const std::string &  name  )  const

Adds another expected call to a mock method.

Parameters:
name unique identifier for method

Definition at line 52 of file VisitableMockObject.cpp.

bool mockpp::VisitableMockObjectBase::isActivated (  )  const

Get information about working mode.

Returns:
false: object is in record mode
true: object is in real world working mode

Definition at line 72 of file VisitableMockObject.cpp.

unsigned mockpp::VisitableMockObjectBase::numController (  )  const

Gets the number of attached controllers.

Returns:
number of controllers

Definition at line 116 of file VisitableMockObject.cpp.

void mockpp::VisitableMockObjectBase::removeController ( Controller pc  ) 

Removes a mock controller.

Parameters:
pc pointer to controller

Definition at line 107 of file VisitableMockObject.cpp.

void mockpp::VisitableMockObjectBase::unsetThrowablesInline (  ) 

Switches exception handling back to pre-1.2 behaviour.

See also:
VisitableMockObject::Controller::unsetThrowablesInline()

Definition at line 94 of file VisitableMockObject.cpp.

void mockpp::VisitableMockObjectBase::visitableVerify (  )  [protected]

Verify that the expected and actual values are equal.

If it fails, an AssertionFailedError is thrown

Definition at line 78 of file VisitableMockObject.cpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines

Generated on Tue Jan 5 09:49:18 2010 for mockpp by  doxygen 1.6.1