2

We use 3rd Party APIs and we have build dlls which run in vendor environment. How can we test these dlls. The API interfaces are very deep with one dll referencing another and that another and so on and we use a tons of these inteface objects. These essentially cannot run at all outside vendor environment

Is this really very untestable or any one has experience mocking similar vendor interfaces in C# environment.

1
  • 1
    In these situation is good to create level of abstraction between vendor code and domain specific code. Then you can mock that level and test domain specific code.
    – Johnny
    Dec 16, 2016 at 18:20

2 Answers 2

0

I'd suggest wrapping them in a simplified facade where possible and mocking out interfaces that are created from the facade. It depends on the circumstances though, this could be quite difficult.

0

I would consider two ways:

  1. abstract from a particular service and implement another layer between your logic and service client. Then mock that layer and cover your code by tests. It may be pretty complex.
  2. If 3rd party API client is delivered using interfaces or abstract classes (and your code does not use particular implementations), you can create a factory for the client that would return their interfaces and them mock that factory. It will allow you to avoid introducing a spare layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.