Fixed a perf issue in the .net api wrapper tests.