运行具有操作的单元测试可能会破坏新 StandardKernel 上的运行时异常的稳定性
在我们的单元测试中,它首先从单例类加载数据库设置,我们有:
IKernel kernel = new StandardKernel(new OurInfrastructureNinjectModule());
_myService = kernel.Get<MyService>(); // To inject a concrete to myService
它在我们的 mvc 应用程序中运行良好,但是,当单元测试调用它时会抛出异常。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
注意:我在 Typemock 工作
由于安全方面的变化< /a> 在 .NET 4 中,Typemock Isolator 中存在一个错误,从标记有
AllowPartiallyTrustedCallers
(APTCA) 或SecurityTransparent
属性的程序集运行的代码会因此异常而崩溃。 Ninject,看起来,就标有这样的属性。我们已在最新版本中修复了此问题,因此请从 http://www.typemock.com 下载。
如果您的问题在最新版本(当前为 6.0.9)中仍然存在,请通过 typemock.com 支持与我们联系
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) orSecurityTransparent
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