Creating Fake Instance


To create a faked instance use the macro FAKE( obj )
#define FAKE ( obj )

 

Parameters:

obj The type of the faked object.


Use the class name as an argument. The FAKE macro will return a new instance of the specified type. You can set the behavior of the new faked instance using WHEN_CALLED macro and its completing statements. See WHEN_CALLED for details.


Remarks:

Example:
ConcreteClass* fakeConcrete = FAKE(ConcreteClass);
/ Creates a faked instance of ConcreteClass.
 WHEN_CALLED(fakeConcrete->GetString()).Return("hello");
 


See also: WHEN_CALLED