But I have goal that all new code should be unit tested. Let just say that WriteFileX and WriteFileY are unique in each case and they are complex pieces of code. In the real world example The Execute Method was even more complex. Writing a test on just the execute method would involve a lot of cut and paste of test code for each instance. Not something that smelled correct to me.

The key here that I want to point out is that when you see virtual; abstract; you should ask if an interface makes sense. In this case the answer I determined that an interface made sense. I refactored the TPacketWriter to implement an interface with the resulting code looking like this:

A big problem with your example: TInterfacedObject and interface reference counting! Your code change completely alters object ownership and lifetime, which is rarely a good idea with legacy code.

A solution is to create a variant of TInterfacedObject that doesn't do reference counting - you'll still gain most of the benefits of interfaces, but your changes will have much less impact on the rest of the legacy codebase.