Sean Chambers
Sean Chambers

Reputation: 8680

Integration testing C++ code from NUnit in managed code

I have a library written in c++ that I want to end-to-end test from C# via interop. Basically this library takes in some parameters and spits out a file at the other end. I want to pass requests to a com interop and then assert that all the data was written correctly to the file.

Is it possible to do this? Is there an easier way? Using pinvoke or something?

Thanks

Upvotes: 0

Views: 400

Answers (1)

Steve Gilham
Steve Gilham

Reputation: 11277

I'd use C++/CLI for gluing together .net tests and native C++ code.

It works well enough in practise : I had a similar issue some months ago -- wanting to verify that a C++ protocol library I'd written would be interoperable with an existing Java implementation. For that I used a thin C++/CLI shim to the C++ code, built the Java as J#, and wrote tests in C#.

Upvotes: 1

Related Questions