Unit Tests and C++
Unit tests can give you a quick way to check for logic errors in the methods of classes in your managed C++ code. A unit test can be created one time and run every time that source code is changed to make sure that no bugs are introduced. You can use unit tests with managed Visual C++ according to the specifics described in this topic. You can also use unit tests in Visual C# and Visual Basic. For more information, see How to: Create and Run a Unit Test.
C++ project type
Unit test support
/clr or /clr:pure
You cannot have test projects with unit tests that use unmanaged C++.
Here are some additional notes about the /clr: option.
Code generation can produce unit tests in any of the Visual C++ test project types: mixed, safe, and pure. The default project type produced is a /clr:safe project. If you want to change your project to /clr or /clr:pure, you can do so at any time by using Visual C++ compiler options. For more information, see /clr (Common Language Runtime Compilation).
If your production code is written in Visual C++, you can generate unit tests only if your product uses the /clr:safe compiler option.
/clr:safe (the default) and /clr:pure does not permit calls to unmanaged code.
If you have to call unmanaged code, use /clr.