1

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.

Remo Gloor
  • 32,665
  • 4
  • 68
  • 98
Gini
  • 96
  • 1
  • 6
  • Our team eventually found it is a 'conflict' between Typemock and Ninject. There are some similar incidents here: [link](http://www.paraesthesia.com/archive/2010/06/04/verificationexception-during-coverage-check-your-security-attributes.aspx) We need to disable Typemock to have the tests run.. which is not a ultimate solution. – Gini May 18 '11 at 20:11

1 Answers1

3

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

Igal Tabachnik
  • 31,174
  • 15
  • 92
  • 157