In my continuing quest to "test all the things" I have set up a managed C++ class library/dll which is being called from a C# Unit-test project. The test code looks a bit like this....
Code:
public static class Caller
{
[DllImport("lib.dll")]
static extern void codeToTest();
}
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Caller.codeToTest();
...
}
}
There is a project dependency between the C++ library and the test project.
Ncrunch is quite happy to build both projects and recognises that the test needs to be re-run if I touch the C++ code. However, it throws an exception saying it can't find the DLL when it tries to run the test...
Quote:System.DllNotFoundException: Unable to load DLL 'lib.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
The DLL _is_ being copied to the unit-test bin/debug folder by the normal build process and if I debug the test using vs/Resharper, they correctly load the DLL.
Is there some special bit of configuration I need to apply to get NCrunch to copy the DLL to its test environment? I'm not sure what's confusing NCrunch here - maybe the fact that folder conventions are different for a C++ project? In this case the lib project outputs to lib\debug\lib.dll rather than lib\bin\debug\lib.dll ?
Thanks for any insight... :-)