views:

20

answers:

2

It's a complex 3rd-party DLL. Phase 1 for My project already finished. I need find a good way to integrate testing with both my DLLs and 3rd-party DLL.

Now I need to replace the 3rd-party DLL with some of my my small DLLs step by step.

All the interface member are same names.

How to disable some of the 3rd-party DLL reference and enable related my small DLL? Thank you.

+2  A: 

If you are using an interface and the 3rd party DLL implements that interface, you can define a new class implementing the same interface. In this case, instanciation of the classes will have to be changed. Change the code like IMyInterface InstanceObject = new ExternalClass(); with IMyInterface InstanceObject = new MyClass();

You can use this technique if uou are not using interface also. In this case you shall have to change like ExternalClass InstanceObject = new ExternalClass(); with MyClass InstanceObject = new MyClass();

Kangkan
Nano HE
@Nano: I could not get what you mean by complex and duplicate functions. If you wish to reuse methods in third party dlls, you can think of deriving your class from their class. But his will fail your intent of replacing them.
Kangkan
+1  A: 

You can hide the calls to the 3rd party library behind interfaces. You can define your own set of interfaces and use a Inversion of Control framework (or roll your own) that gets an implementation based on the interface and configure the actual implementation in the startup path of your application or in a configuration file (depending on the IoC framework you use).

Steven