getoptnet
getoptnet copied to clipboard
Unable to run .PrintUsage() in test environment due to System.Reflection.Assembly dependency
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?