public static Task <VsInstance> Launch(VsHive hive, TimeSpan timeout, IDiagnostics diagnostics) { Process process = null; KillProcessJob killProcessJob = null; return(diagnostics.RunAsync("Launching Instance", async output => { try { process = VisualStudioUtil.StartProcess(hive); killProcessJob = new KillProcessJob(process); var dte = await VisualStudioUtil.GetDTE(process, timeout); var invoker = (IRemoteComInvoker)dte.GetObject("VsixTesting.Invoker"); InvokeRemote(invoker, nameof(Remote.AutoKillWhenProcessExits), Process.GetCurrentProcess().Id); killProcessJob.Release(); return new VsInstance(hive.Version, process, dte, invoker); } catch { process?.Kill(); process?.Dispose(); throw; } })); }
void FactRunningInsideVisualStudio() => Assert.NotNull(VisualStudioUtil.GetDTE(Process.GetCurrentProcess()));
void TheoryRunningInsideVisualStudio(int zero) { Assert.NotNull(VisualStudioUtil.GetDTE(Process.GetCurrentProcess())); Assert.Equal(0, zero); }