작업을 갖는 실행 단위 테스트는 새로운 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 응용 프로그램에서는 잘 실행되지만, 단위 테스트에서 호출 할 때 예외가 던져

도움이 되었습니까?

해결책

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