public void CanAttachToProcessWithDebugger()
        {
            var debuggerSetup = new DebuggerSetup();
            var logger        = new MarkupStreamLogger(TestLog.Default);
            var debugger      = new VisualStudioDebugger(debuggerSetup, logger, null);

            ProcessStartInfo processStartInfo = CreateProcessStartInfoForDummyProcess();

            Process process = Process.Start(processStartInfo);

            try
            {
                Assert.IsFalse(debugger.IsAttachedToProcess(process), "Initially the debugger is not attached.");

                Assert.AreEqual(AttachDebuggerResult.Attached, debugger.AttachToProcess(process),
                                "Should attach to process.");
                Assert.IsTrue(debugger.IsAttachedToProcess(process), "Should report that it has attached to process.");
                Assert.AreEqual(AttachDebuggerResult.AlreadyAttached, debugger.AttachToProcess(process),
                                "Should report that it was already attached to process.");

                /* This fails because Visual Studio returns "The requested operation is not supported."
                 * It seems to be related to having the Native debugger engine attached.
                 * Assert.AreEqual(DetachDebuggerResult.Detached, debugger.DetachFromProcess(process), "Should detach from process.");
                 * Assert.IsFalse(debugger.IsAttachedToProcess(process), "Finally the debugger is not attached.");
                 * Assert.AreEqual(DetachDebuggerResult.AlreadyDetached, debugger.DetachFromProcess(process), "Should report that it was already detached from process.");
                 */
            }
            finally
            {
                process.Kill();
            }
        }
        public void AttachToProcess_WhenProcessIsNull_Throws()
        {
            var debuggerSetup = new DebuggerSetup();
            var logger = MockRepository.GenerateStub<ILogger>();
            var debugger = new VisualStudioDebugger(debuggerSetup, logger, null);

            Assert.Throws<ArgumentNullException>(() => debugger.AttachToProcess(null));
        }
        public void AttachToProcess_WhenProcessIsNull_Throws()
        {
            var debuggerSetup = new DebuggerSetup();
            var logger        = MockRepository.GenerateStub <ILogger>();
            var debugger      = new VisualStudioDebugger(debuggerSetup, logger, null);

            Assert.Throws <ArgumentNullException>(() => debugger.AttachToProcess(null));
        }
        public void CanAttachToProcessWithDebugger()
        {
            var debuggerSetup = new DebuggerSetup();
            var logger = new MarkupStreamLogger(TestLog.Default);
            var debugger = new VisualStudioDebugger(debuggerSetup, logger, null);

            ProcessStartInfo processStartInfo = CreateProcessStartInfoForDummyProcess();

            Process process = Process.Start(processStartInfo);
            try
            {
                Assert.IsFalse(debugger.IsAttachedToProcess(process), "Initially the debugger is not attached.");

                Assert.AreEqual(AttachDebuggerResult.Attached, debugger.AttachToProcess(process),
                    "Should attach to process.");
                Assert.IsTrue(debugger.IsAttachedToProcess(process), "Should report that it has attached to process.");
                Assert.AreEqual(AttachDebuggerResult.AlreadyAttached, debugger.AttachToProcess(process),
                    "Should report that it was already attached to process.");

                /* This fails because Visual Studio returns "The requested operation is not supported."
                 * It seems to be related to having the Native debugger engine attached.
                Assert.AreEqual(DetachDebuggerResult.Detached, debugger.DetachFromProcess(process), "Should detach from process.");
                Assert.IsFalse(debugger.IsAttachedToProcess(process), "Finally the debugger is not attached.");
                Assert.AreEqual(DetachDebuggerResult.AlreadyDetached, debugger.DetachFromProcess(process), "Should report that it was already detached from process.");
                 */
            }
            finally
            {
                process.Kill();
            }
        }