mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Deprecate ATL based IPC wrapper library (#2248)
* Deprecate ATL based IPC wrapper library * C# projects now use named pipe server implementations from two_way_pipe_message through the interop C++/Cli library. * Added Unit testing to interop library
This commit is contained in:
committed by
GitHub
parent
81551104ce
commit
63d989cab4
55
src/common/interop-tests/UnitTest1.cs
Normal file
55
src/common/interop-tests/UnitTest1.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.IO.Pipes;
|
||||
using interop;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
|
||||
namespace interop_tests
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
private string SERVER_SIDE = "\\\\.\\pipe\\serverside";
|
||||
private string CLIENT_SIDE = "\\\\.\\pipe\\clientside";
|
||||
|
||||
private TwoWayPipeMessageIPCManaged clientPipe;
|
||||
|
||||
[TestInitialize]
|
||||
public void Initialize()
|
||||
{
|
||||
clientPipe = new TwoWayPipeMessageIPCManaged(CLIENT_SIDE, SERVER_SIDE, null);
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup()
|
||||
{
|
||||
clientPipe.End();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestSend()
|
||||
{
|
||||
var testString = "This string is a test\n";
|
||||
var reset = new AutoResetEvent(false);
|
||||
|
||||
var serverPipe = new TwoWayPipeMessageIPCManaged(
|
||||
SERVER_SIDE,
|
||||
CLIENT_SIDE,
|
||||
(string msg) =>
|
||||
{
|
||||
Assert.AreEqual(testString, msg);
|
||||
reset.Set();
|
||||
});
|
||||
serverPipe.Start();
|
||||
clientPipe.Start();
|
||||
|
||||
clientPipe.Send(testString);
|
||||
reset.WaitOne();
|
||||
|
||||
serverPipe.End();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user