Calling Hidden Members

Top  Previous  Next

With Isolator++ Professional you can now call private members.
This is sometimes required in tests - to either test that method, or used to setup a state that is required for the tests.
For this, you'll use the ISOLATOR_INVOKE_ API.

 

To call a private instance member

 

ISOLATOR_INVOKE_FUNCTION(retVar,&instance,PrivateMemeber, args...);

 

In a similar fashion, a static method can be called by passing

 

ISOLATOR_INVOKE_FUNCTION(retVar,_,MyClass::PrivateMemeber, args...);

 

Static c functions can be called as follows

 

ISOLATOR_INVOKE_FUNCTION(retVar,_, staticFunctionInModule, args...);

 

Note: To catch an exception thrown in an INVOKE PRIVATE method within your test (on a 64-bit system), use the HandleExceptionInTest flag.
For more details, see Setting Default Behavior of a Faked Class.


Copyright  Typemock Ltd. 2009-2025.  All Rights Reserved.