2
votes

Following problem: We use the mocking library Moq in our unit tests. Therefore we have an InternalsVisibleTo attribute to the DynamicProxyGenAssembly2. Furthermore we obfuscate our assemblies. Here comes the problem - All our internal interfaces and classes are no longer obfuscated because of the DynamicProxyGenAssembly2.

As far as I have read most mocking libraries use this DynamicProxyGenAssembly2. Even if they do not I dont think there are mocking libraries which can mochk internal interfaces without InternalsVisibleTo.

Had someone of you the same problem and how have you solved it. I want to use mocking and obfuscation - is this possible?

Regards, Yggdrasil.

EDIT

It is possible if the mocking assembly is open source and dont relay on third party assemblies which again needs access to these interfaces. Than we could include the mocking assembly in our build process and it would obfuscated together with our assemblies. Is there such a open source mocking system?

1

1 Answers

2
votes

Maybe you can have 2 build configurations, one unobfuscated for unit testing and one release configuration with all your security features. The InteralsVisibleTo attribute is only needed for the first configuration.