Pages

Sunday 28 December 2008

Using NUnit with C++ - Part 2

Follow up from part 1 We've been experimenting at work with writing unit-tests against native code for 2 months now. We're using NUnit together with CruiseControl and it works fine.
  • the test project is a C++/CLI DLL compiled with /CLR option.
  • the project containing the code under test has an additional project configuration that generates a static LIB instead of an executable.
  • the test project links to the native LIB above.
What if the code under test is C++ compiled with /CLR? For some reason I thought it wasn't possible to create a static LIB when the /CLR option was active. C++/CLI is very flexible and you can generate a static library containing a mix of managed and unmanaged code. The purpose of building a mixed static lib is to easily import native code into a test project. We keep the test project and the code under test in separate solutions.

No comments: