Exemple #1
0
        private void DoTest(bool expectedResult)
        {
            string pipeId            = Guid.NewGuid().ToString();
            int    debuggeeProcessId = 2017;

            // ReSharper disable once UnusedVariable
            var host = new DebuggerAttacherServiceHost(pipeId, MockDebuggerAttacher.Object, MockLogger.Object);

            try
            {
                host.Open();

                var client = new MessageBasedDebuggerAttacher(pipeId, Timeout, MockLogger.Object);

                client.AttachDebugger(debuggeeProcessId, DebuggerEngine.Native).Should().Be(expectedResult);

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

                host.Close();
            }
            catch (CommunicationException)
            {
                host.Abort();
                throw;
            }
        }
        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);
            }
        }