A function I have to mock gets a callback as a parameter. In my stub I would like to return immediately but call the callback asynchronously later on (like it would be in reality as the function normally accesses a database).
What's best practice how to do that in C++?
I guess it's something like:
1 2 3 4 5
bool functionToBeMocked(CallbackObject* cb)
{
doAsync(cb->callback()); //how to implement doAsync?? using a new thead?
returntrue;
}