コード例 #1
0
ファイル: ConsoleTests.cs プロジェクト: sasqwatch/Vanara
        public void ConsoleTest()
        {
            var p = CSharpRunner.RunProcess(typeof(ConsoleTestProcess));

            p.WaitForExit();
            Assert.That(p.ExitCode, Is.Zero);
        }
コード例 #2
0
        // TODO: Figure out how WaitForDebugEvent works
        // [Test]
        public void TestMethod()
        {
            var p   = CSharpRunner.RunProcess(typeof(DebugProcess));
            var pid = (uint)p.Id;

            Assert.That(DebugActiveProcess(pid), ResultIs.Successful);
            //Assert.That(ContinueDebugEvent(pid, ))
            Assert.That(WaitForDebugEvent(out var evt, 2000));
            DebugActiveProcessStop(pid);
        }
コード例 #3
0
        public unsafe void ConnectNamedPipeTest()
        {
            using (var hPipe = CreateNamedPipe(PipeClientWriter.pipeName, PIPE_ACCESS.PIPE_ACCESS_DUPLEX, PIPE_TYPE.PIPE_TYPE_BYTE | PIPE_TYPE.PIPE_READMODE_BYTE | PIPE_TYPE.PIPE_WAIT, 10, 1024 * 16, 1024 * 16, 60000))
            {
                Assert.That(hPipe, ResultIs.ValidHandle);

                var p = CSharpRunner.RunProcess(typeof(PipeClientWriter));
                Assert.That(ConnectNamedPipe(hPipe), ResultIs.Successful);

                var buffer = new byte[1024];
                Assert.That(PeekNamedPipe(hPipe, buffer, (uint)buffer.Length - 1, out var peekRead, out var peekAvail, out var peekLeft), ResultIs.Successful);
                //Assert.That(peekRead, Is.EqualTo(PipeClientWriter.bytesToWrite.Length));
                Assert.That(ReadFile(hPipe, buffer, (uint)buffer.Length - 1, out var nRead), ResultIs.Successful);
                Assert.That(nRead, Is.EqualTo(PipeClientWriter.bytesToWrite.Length));

                Assert.That(DisconnectNamedPipe(hPipe), ResultIs.Successful);
            }
        }