Пример #1
0
        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;
                }
            }));
        }
Пример #2
0
 void FactRunningInsideVisualStudio()
 => Assert.NotNull(VisualStudioUtil.GetDTE(Process.GetCurrentProcess()));
Пример #3
0
 void TheoryRunningInsideVisualStudio(int zero)
 {
     Assert.NotNull(VisualStudioUtil.GetDTE(Process.GetCurrentProcess()));
     Assert.Equal(0, zero);
 }