2

Possible Duplicate:
.NET NUnit test - Assembly.GetEntryAssembly() is null

System.Reflection.Assembly assem = System.Reflection.Assembly.GetEntryAssembly();

The code returns null when running a unit test. I am testing for a third party utility that also returns null. I cannot distinguish between the two programs if both of them return null.

What can I do to determine I am running in a unit test context programatically? I do not want to add it to the configuration file because of the point of failure that creates. E.G. I forgot to flip the bit so it gets pushed to Prod in dev mode. My boss pushes to prod. I do not want him to have to repeat a job or change configuration files regularly for obvious political motivations.

Community
  • 1
  • 1
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
  • 1) [Assembly.GetEntryAssembly() Returns Nothing when running from a Unit Test](http://social.msdn.microsoft.com/Forums/eu/vststest/thread/7ff8caae-56c6-4baa-94c9-7224f69dbd17) 2) [.NET NUnit test - Assembly.GetEntryAssembly() is null](http://stackoverflow.com/questions/4337201/net-nunit-test-assembly-getentryassembly-is-null) – sll Feb 15 '12 at 20:18
  • What kind of unit testing framework are you using? – svick Feb 15 '12 at 20:39
  • @svick updated question tags. – P.Brian.Mackey Feb 15 '12 at 20:44

0 Answers0