I am going to start implementing some unit tests for a codebase that is a mix of managed and unmanaged C++. Can NUnit hack it with unmanaged code? Is there a better alternative?
From stackoverflow
-
It's possible to use NUnit to test unmanaged code, example:
// Tests.h #pragma once #include <cmath> using namespace System; using namespace NUnit::Framework; namespace Tests { [TestFixture] public ref class UnitTest { public: UnitTest(void) {} [Test] void TestCos() { Assert::AreEqual(1, cos(0.0)); } }; }
-
NUnit will work fine with unmanaged code as long as you write the unit tests in managed C++. The outside wrapper will be NUnit friendly and can access the unmanaged parts.
0 comments:
Post a Comment