Mocking 3rd party callback events using moq

后端 未结 2 744
予麋鹿
予麋鹿 2021-02-09 09:41

We\'ve been trying write unit tests for a worker class written in C#, which mocks out a third party API (COM based) using moq to dynamically create the mock objects. NUnit is ou

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-09 09:57

    Can you redefine the COM interface from the 3rd party and use it with moq.

    It seems your intention is to moq away the external dependency and moq isn't playing nicely with the COMInterop assembly, you should be able to open reflector and pull any interface definitions you want from the interop assembly, define the mock and run your unit tests

提交回复
热议问题