Say you\'re testing class A
and it has a dependency injection of B
which has a dependency injection of C
.
So you mock B
In this case you should inject by pointer and not by reference, then you could pass a NULL pointer. This would work assuming you're object is indeed a mock and not a fake object, therefore it has no real dependency on the injected object.
For boost::shared_ptr
you could do the following:
boost::shared_ptr null_c_ptr;
MockB mock_b(null_c_ptr);