diff options
Diffstat (limited to 'src/csharp/Grpc.Core.Tests/PInvokeTest.cs')
-rw-r--r-- | src/csharp/Grpc.Core.Tests/PInvokeTest.cs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs index af55cb0566..da0ea2e6dc 100644 --- a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs +++ b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs @@ -1,6 +1,6 @@ #region Copyright notice and license -// Copyright 2015, Google Inc. +// Copyright 2015-2016, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -45,13 +45,9 @@ namespace Grpc.Core.Tests { public class PInvokeTest { - int counter; - - [DllImport("grpc_csharp_ext.dll")] - static extern GRPCCallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] OpCompletionDelegate callback); + static readonly NativeMethods Native = NativeMethods.Get(); - [DllImport("grpc_csharp_ext.dll")] - static extern IntPtr grpcsharp_test_nop(IntPtr ptr); + int counter; /// <summary> /// (~1.26us .NET Windows) @@ -87,7 +83,7 @@ namespace Grpc.Core.Tests 1000000, 10000000, () => { - grpcsharp_test_callback(handler); + Native.grpcsharp_test_callback(handler); }); Assert.AreNotEqual(0, counter); } @@ -106,7 +102,7 @@ namespace Grpc.Core.Tests 10000, 10000, () => { - grpcsharp_test_callback(new OpCompletionDelegate(Handler)); + Native.grpcsharp_test_callback(new OpCompletionDelegate(Handler)); }); Assert.AreNotEqual(0, counter); } @@ -122,7 +118,7 @@ namespace Grpc.Core.Tests 1000000, 100000000, () => { - grpcsharp_test_nop(IntPtr.Zero); + Native.grpcsharp_test_nop(IntPtr.Zero); }); } |