什么是DynamicProxyGenAssembly2程序集? [英] What is the DynamicProxyGenAssembly2 assembly?

查看:496
本文介绍了什么是DynamicProxyGenAssembly2程序集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Moq进行单元测试.要测试内部接口,我必须向DynamicProxyGenAssembly2程序集声明InternalsVisibleTo属性.

I use Moq for my unit tests. To test internal interfaces I have to declare the InternalsVisibleTo attribute to the DynamicProxyGenAssembly2 assembly.

我们对测试进行混淆处理,这很有用,因为使用这种方法可能会发现混淆问题.由DynamicProxyGenAssembly2程序集引起的,我的组件没有被混淆.

We run our tests obfuscated, which is useful because we could found some problems with obfuscation with this approach. Caused by the DynamicProxyGenAssembly2 assembly my component is not obfuscated.

因此,我需要知道什么是DynamicProxyGenAssembly2程序集?我在磁盘上的任何地方都找不到它.是将其编译到moq.dll中还是在运行时生成?也许如果我知道该程序集是什么,我们就可以找到一种方法来解决我的问题.有人遇到过同样的问题吗?

Therefore I need to know what is the DynamicProxyGenAssembly2 assembly? I could not found it anywhere on my disk. Is it compiled into the moq.dll or is it generated at runtime? Maybe if I know what this assembly I we coul find a way to workaround my problem. Has somebody encountered the same problem?

请不要建议我们需要保持畅通无阻地运行测试.目前,这是没有选择的.

Please dont suggest that we need to run our tests unobfscated. At this point this is no option.

编辑

DynamicProxyGenAssembly2在运行时生成.为了满足Dotfuscator的要求,在Moq旁边放了一个空的dll.此外,我们还必须修改Castle.Core dll以使用您的公钥. 此处.有了这个,我们可以顺利进行所有测试,而不会出现问题.

The DynamicProxyGenAssembly2 is generated at runtime. To satisfy the Dotfuscator is have put an empty dll beside Moq. Additionally we had to modify the Castle.Core dll to use your public key. The last problems we had was answered here. With this we could run all our tests obfuscated without problems.

关于,伊格德拉西尔.

推荐答案

DynamicProxyGenAssembly2是由使用诸如Moq或NSubsitute之类的CastleProxy的模拟系统构建的临时程序集.它是在需要模拟时生成的,并在测试完成后丢弃.

DynamicProxyGenAssembly2 is a temporary assembly built by mocking systems that use CastleProxy like Moq or NSubsitute. It is generated when the mock is needed and disposed of after the tests are finished.

对于Expose Internals方法而言,有一种RhinoMocks解决方案可以以最小的更改适用于您的Moq:

As for the Expose Internals method than there is a RhinoMocks solution that would work for your Moq one with minimal changes:

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆