Bullying Microsoft DLL

I have an application that references the Microsoft DLL (Exchange Web Services). In my unit testing, I want to replace the Microsoft DLL with a Mock.

What works with other DLLs does not work with this DLL, since I get an exception

The installed assembly manifest definition does not match the assembly reference

I checked that it has the same build version, but I saw that the Microsoft DLL is digitally signed, so it has a PublicKeyToken. Could this be what my app is looking for? Similarly signed dll?

Is there a way to link to a DLL without requiring its public?

thanks

+8
c # dll mocking assemblies
source share
1 answer

You cannot make fun of a signed DLL. (If you could be hired by the mafia ...)

Discard the code that accesses the code in this DLL.

Create a facade (if you don’t have one) that wraps access to methods in the Exchange dll. Then in your tests you can provide a mock-up facade.

Good design practice protects your code from any third-party code (assemblies, web services, management) using facades / wrappers. This minimizes the risk of exposure when changing the code of a third party, i.e. updating to a newer version of the dll (necessary changes will only affect the facade) and help with testing.

+13
source share

All Articles