Test dell'unità in esecuzione Avere operazione potrebbe destabilizzare l'eccezione di runtime a New StandardKernel

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

Domanda

Nei nostri test dell'unità in cui il primo caricamento di DB impostando da una classe Singleton, abbiamo:

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

funziona bene nella nostra applicazione MVC, tuttavia, l'eccezione ha lanciato quando viene chiamato per test unità.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top