- Mocking data members - 1 Update
"Thomas W." <thomas....@gmail.com>: Jun 10 01:54PM -0400
In "A Case for Mock Turtles" is a pretty simple example of defining an
interface for your dependency. But what if my class has data members of my
dependency? You can't declare data members of an abstract class.
I can make my class a template and resolve the data member on instantiation
of the class. So during tests I can instantiate with the mock class, and
during production I can instantiate with the real class. I can use the
"real" class as a default template parameter so it doesn't muck up my API.
But this seems to mean I have to use a lot of dynamic casting on my data
members if I want code completion. And all of this feels funny to me. Am
I going down the right path here?
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to googletestframe...@googlegroups.com.