private void DoTest(bool expectedOutcome, string expectedErrorMessagePart)
        {
            string pipeId            = Guid.NewGuid().ToString();
            int    debuggeeProcessId = 2017;

            // ReSharper disable once UnusedVariable
            using (var service = new DebuggerAttacherService(pipeId, MockDebuggerAttacher.Object, MockLogger.Object))
            {
                var client = MessageBasedDebuggerAttacher.CreateAndStartPipeClient(
                    pipeId,
                    (connection, msg) => { _messages.Add(msg); _resetEvent.Set(); },
                    MockLogger.Object);
                client.Should().NotBeNull();

                client.PushMessage(new AttachDebuggerMessage {
                    ProcessId = debuggeeProcessId
                });

                _resetEvent.Wait(WaitingTime).Should().BeTrue();
                _messages.Count.Should().Be(1);

                var message = _messages.Single();
                message.ProcessId.Should().Be(debuggeeProcessId);
                message.DebuggerAttachedSuccessfully.Should().Be(expectedOutcome);
                if (string.IsNullOrEmpty(expectedErrorMessagePart))
                {
                    message.ErrorMessage.Should().Be(expectedErrorMessagePart);
                }
                else
                {
                    message.ErrorMessage.Should().Contain(expectedErrorMessagePart);
                }
            }
        }
        private void DoTest(bool expectedResult)
        {
            string pipeId            = Guid.NewGuid().ToString();
            int    debuggeeProcessId = 2017;

            // ReSharper disable once UnusedVariable
            using (var service = new DebuggerAttacherService(pipeId, MockDebuggerAttacher.Object, MockLogger.Object))
            {
                var client = new MessageBasedDebuggerAttacher(pipeId, Timeout, MockLogger.Object);

                client.AttachDebugger(debuggeeProcessId).Should().Be(expectedResult);

                MockDebuggerAttacher.Verify(a => a.AttachDebugger(It.Is <int>(processId => processId == debuggeeProcessId)),
                                            Times.Once);
            }
        }