Running Unit Test having Operation could destablize the runtime exception at new StandardKernel

久未见 提交于 2019-12-11 05:52:08

问题


In our unit tests where it first load db setting from a singleton class, we have:

IKernel kernel = new StandardKernel(new OurInfrastructureNinjectModule());
_myService = kernel.Get<MyService>(); // To inject a concrete to myService

It runs fine in our mvc application, however, exception threw when it is called by unit tests.


回答1:


Note: I work at Typemock

Due to changes in security in .NET 4, there was a bug in Typemock Isolator where code running from assemblies marked with AllowPartiallyTrustedCallers (APTCA) or SecurityTransparent attributes would crash with this exception. Ninject, seems like it, is marked with such an attribute.

We had fixed this issue in the latest version, so please download it at http://www.typemock.com.

If your issue persists in the latest version (6.0.9 currently), please contact us via support at typemock.com



来源:https://stackoverflow.com/questions/6036524/running-unit-test-having-operation-could-destablize-the-runtime-exception-at-new

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!