I've just started to work with NUnit in order to provide some test coverage for my projects.
Within my main library.dll I need to load up configuration data from an external file that goes with the library, library.xml.
This works fine when I'm using the library, because I use the following to get the directory in which to look for the config file:
string settingspath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
The problem I've noticed is that when I'm unit testing with NUnit, it copies my assemblies to a Shadow Copy, but doesn't take any of the other files with it, so of course my init fails due to missing config files.
Should I be doing something different to locate config files from within my library? (it's a server app, and I don't want to use the standard app settings, or user's local settings, etc)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…