samedi 3 octobre 2015

Can a unit test replace (masquerade as ?) a DLL?

Can a unit test replace a DLL?

My setup is as follows: Visual Studio 2013. Writing a stock trading application in C# targeting the .NET 4.0 framework.

The chart below shows the architecture. I am using a 3rd party API which I assume works. I need to test my Order Manager (Device Under Test). It is a Console Application, targeting .NET 4.0. The Order Manager interfaces to a 3rd party API. The DLL is my hard-coded algorithm which watches the market (provided to it by the Order Manager) and places trades. The Order Manager will know which DLLs placed which order and will interface with the appropriate DLL when the order is filled. Upon initialization, the Order Manager will spin up the DLLs.

I want to test the Order Manager. Ideally, my unit tests would masquerade as separate DLLs before the Order Manager is started. Is this what people call "DLL Injection" ?? This is new to me and would greatly appreciate pointers.

+---------+   +----------+   +---------------+   +-----------+
|         |   |  API     |   | Order Manager |   |  Algorithm|
| Exchange|<->|  DLL     |<->| Console App   |<->|     DLL   | 
|         |   | 3rd party|   |    DUT        |   |           |  
+---------+   +----------+   +---------------+   +-----------+

Thanks -Ed

Aucun commentaire:

Enregistrer un commentaire