mockpp::ExpectationCounter Class Reference
[Basic Mock Objects]

A class to verify the expected count of an event. More...

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

List of all members.

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.

Detailed Description

A class to verify the expected count of an event.

Definition at line 45 of file ExpectationCounter.h.


Constructor & Destructor Documentation

mockpp::ExpectationCounter::ExpectationCounter ( const String name,
VerifiableList parent = 0 
)

Constructs the expectation.

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

Definition at line 41 of file ExpectationCounter.cpp.


Member Function Documentation

unsigned mockpp::ExpectationCounter::getActual (  )  const

Gets the number of actual calls.

Returns:
counter value.

Definition at line 71 of file ExpectationCounter.cpp.

void mockpp::ExpectationCounter::setExpected ( unsigned  expectedMinCalls,
unsigned  expectedMaxCalls 
)

Sets the range of expected calls.

Parameters:
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.

Parameters:
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.


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:48:58 2010 for mockpp by  doxygen 1.6.1