运行单元测试具有操作可能会使新StandardKernel稳定运行时异常
-
14-11-2019 - |
题
在我们的单元测试中,它首先从Singleton类加载DB设置,我们有:
IKernel kernel = new StandardKernel(new OurInfrastructureNinjectModule());
_myService = kernel.Get<MyService>(); // To inject a concrete to myService
.
它在MVC应用程序中运行精细,但是,当单元测试调用时,异常抛出。
解决方案
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
不隶属于 StackOverflow