Add an extra method to the mock class, AddValues
. It will exist only in that mock class, not in the real class, so your objection that the extra code would appear in production is unfounded.
I suspect you thought the code would need to be in production because you're dealing with the mock object exclusively through the interface. The extra method would exist in the interface, and would therefore need to be implemented in the production version of the class, even though it doesn't belong there.
Instead, instantiate the TMockDBTable
and access it through the object reference to set it up however it's needed for the test. Once it's ready, then switch to using it via the IIDBTable
interface.
Another option is to feed the data into the class through a parameter you add to its constructor. Then you don't even need the extra method, and so there's no temptation to define that method on the interface or on the production class. There's no reason your mock class's constructor needs to look like the production class's constructor since the classes aren't related at all. The constructor isn't part of the interface definition.