Base class for a generic object that can be used to replace a real world object for testing purposes. More...
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 |
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.
mockpp::VisitableMockObjectBase::VisitableMockObjectBase | ( | const String & | name, | |
VerifiableList * | parent | |||
) |
Construct the item.
name | human readable description about the object | |
parent | parent verifiable |
Definition at line 40 of file VisitableMockObject.cpp.
void mockpp::VisitableMockObjectBase::addActualMethod | ( | const std::string & | name | ) | const |
Adds another actual call to a mock method.
name | unique identifier for method |
Definition at line 59 of file VisitableMockObject.cpp.
void mockpp::VisitableMockObjectBase::addController | ( | Controller * | pc | ) |
Adds another mock controller.
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.
name | unique identifier for method |
Definition at line 52 of file VisitableMockObject.cpp.
bool mockpp::VisitableMockObjectBase::isActivated | ( | ) | const |
Get information about working mode.
Definition at line 72 of file VisitableMockObject.cpp.
unsigned mockpp::VisitableMockObjectBase::numController | ( | ) | const |
Gets the number of attached controllers.
Definition at line 116 of file VisitableMockObject.cpp.
void mockpp::VisitableMockObjectBase::removeController | ( | Controller * | pc | ) |
Removes a mock controller.
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.
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.