A class to verify the expected count of an event. More...
Public Member Functions | |
ExpectationCounter (const String &name, VerifiableList *parent=0) | |
Constructs the expectation. | |
virtual void | clearActual () |
Resets the internal state to reflect that there is no actual value set. | |
virtual void | reset () |
Resets the internal state completely. | |
void | inc () |
Increments the actual number of calls by 1. | |
void | setExpected (unsigned expectedCalls) |
Sets the exact number of expected calls. | |
void | setExpected (unsigned expectedMinCalls, unsigned expectedMaxCalls) |
Sets the range of expected calls. | |
void | setExpectNothing () |
Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error. | |
unsigned | getActual () const |
Gets the number of actual calls. | |
virtual void | verify () |
Verify that the amount of calls is within the allowed bounds. | |
Protected Member Functions | |
virtual void | clearExpectation () |
Clears the expectation list. |
A class to verify the expected count of an event.
Definition at line 45 of file ExpectationCounter.h.
mockpp::ExpectationCounter::ExpectationCounter | ( | const String & | name, | |
VerifiableList * | parent = 0 | |||
) |
Constructs the expectation.
name | human readable description about the expectation | |
parent | parent verifiable |
Definition at line 41 of file ExpectationCounter.cpp.
unsigned mockpp::ExpectationCounter::getActual | ( | ) | const |
Gets the number of actual calls.
Definition at line 71 of file ExpectationCounter.cpp.
void mockpp::ExpectationCounter::setExpected | ( | unsigned | expectedMinCalls, | |
unsigned | expectedMaxCalls | |||
) |
Sets the range of expected calls.
expectedMinCalls | lower bound of expected calls | |
expectedMaxCalls | upper bound of expected calls |
Definition at line 91 of file ExpectationCounter.cpp.
void mockpp::ExpectationCounter::setExpected | ( | unsigned | expectedCalls | ) |
Sets the exact number of expected calls.
expectedCalls | number of expected calls |
Definition at line 101 of file ExpectationCounter.cpp.
void mockpp::ExpectationCounter::setExpectNothing | ( | ) | [virtual] |
Tell the object to expect nothing to happen to it, perhaps because the test is exercising the handling of an error.
The Expectation will fail if any actual values are set.
Note that this is not the same as not setting any expectations, in which case verify() will do nothing.
Implements mockpp::Expectation.
Definition at line 108 of file ExpectationCounter.cpp.
void mockpp::ExpectationCounter::verify | ( | ) | [virtual] |
Verify that the amount of calls is within the allowed bounds.
If it fails, an AssertionFailedError is thrown
Implements mockpp::AbstractExpectation< unsigned >.
Definition at line 117 of file ExpectationCounter.cpp.