getoptnet icon indicating copy to clipboard operation
getoptnet copied to clipboard

Unable to run .PrintUsage() in test environment due to System.Reflection.Assembly dependency

Open patoncrispy opened this issue 10 years ago • 0 comments

I'm trying to write tests to ensure my application behaves the way I want it to when arguments are invalid. Unfortunately, when I call PrintUsage() I get a NullReferenceException because GetOptNet makes a call to Assembly.GetEntryAssembly(), which returns null.

To give you an idea of my setup, I have my production code and testing code in two separate libraries, with my test code referencing my production code. I'm using NUnit as a testing framework.

Is there a way of avoiding this dependency/injecting a mocked one?

patoncrispy avatar Sep 30 '14 10:09 patoncrispy