Unit Testing Native C++ Applications with out “/clr” flag or fall back to 3rd party frameworks

Visual Studio 11 provides the ability to do Unit Testing Native C++ Applications with a new C++ unit testing framework shipping with VS 11.

So the C++ developers no longer need to use the “/clr” flag or fall back to 3rd party frameworks.

To learn more about native unit testing in Visual Studio 11, please visit MSDN.

Invoke Native C++ DLL from .NET Code

There are 4 Approaches to accomplish this.

Approach 1. (Explicit) P/Invoke
Approach  2. Dynamic P/Invoke
Approach 3. Implicit P/Invoke (Use a C++/CLI wrapper)
Approach 4. Convert C++ DLL to a COM server, and call it from .NET code through .NET-COM interop

I don’t like to reinvent the wheel so please go through msdn forum answer here