运行具有操作的单元测试可能会破坏新StandardKernel上的运行时异常 [英] Running Unit Test having Operation could destablize the runtime exception at new StandardKernel
问题描述
在我们的单元测试中,它首先从单例类中加载数据库设置,我们有:
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
它在我们的mvc应用程序中运行良好,但是,当被单元测试调用时抛出异常.
It runs fine in our mvc application, however, exception threw when it is called by unit tests.
推荐答案
注意:我在Typemock工作
由于.NET 4中安全性更改, Typemock隔离器中的一个错误,其中从标记有AllowPartiallyTrustedCallers
(APTCA)或SecurityTransparent
属性的程序集运行的代码将因该异常而崩溃. Ninject似乎带有这样的属性.
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.
我们已在最新版本中修复了此问题,因此请从 http://www.typemock.com下载.
We had fixed this issue in the latest version, so please download it at http://www.typemock.com.
如果您的问题仍然是最新版本(当前为6.0.9),请通过typemock.com的支持与我们联系
If your issue persists in the latest version (6.0.9 currently), please contact us via support at typemock.com
这篇关于运行具有操作的单元测试可能会破坏新StandardKernel上的运行时异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!