2009-01-14 31 views

回答

5

這是可能的使用NUnit測試非託管代碼,例如:

// 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)); 
     } 

    }; 
} 
2

NUnit的將你寫的託管C單元測試工作正常與非託管代碼,只要++。外部包裝將NUnit友好,可以訪問非託管部分。

相關問題