操作を持つ実行中のユニットテストは、新しいStandardKernelでランタイム例外を不安定にする可能性があります。

StackOverflow https://stackoverflow.com/questions/6036524

質問

シングルトンクラスから最初にDB設定をロードする当社の単位テストでは、

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

MVCアプリケーションでは細かく動作しますが、Exceptionは単体テストで呼び出されたときにスローしました。

役に立ちましたか?

解決

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top