コード例 #1
0
        public int GetRunningDocumentsEnum(out IEnumRunningDocuments ppenum)
        {
            IEnumRunningDocuments penum = null;
            int res = _vs.Invoke(() =>
            {
                penum = new RunningDocumentsEnum(this);
                return(VSConstants.S_OK);
            });

            ppenum = penum;
            return(res);
        }
コード例 #2
0
ファイル: CompletionTests.cs プロジェクト: sunsure/PTVS
 public void FromOSPathImportCompletions3x()
 {
     using (var vs = new MockVs()) {
         var factory = vs.Invoke(() => vs.GetPyService().InterpreterRegistryService.Interpreters.LastOrDefault(p => p.Configuration.Version.Major == 3));
         OSPathImportTest(vs, factory);
     }
 }
コード例 #3
0
 public List <Completion> GetCompletionListNoRetry(
     int index,
     bool assertIfNoCompletions = true,
     ITextSnapshot snapshot     = null
     )
 {
     VS.Invoke(() => {
         snapshot = snapshot ?? CurrentSnapshot;
         if (index < 0)
         {
             index += snapshot.Length + 1;
         }
         View.MoveCaret(new SnapshotPoint(snapshot, index));
         View.MemberList();
     });
     using (var sh = View.WaitForSession <ICompletionSession>(assertIfNoSession: assertIfNoCompletions)) {
         if (sh == null)
         {
             return(new List <Completion>());
         }
         Assert.AreNotEqual(0, sh.Session.CompletionSets.Count);
         return(sh.Session.CompletionSets.SelectMany(cs => cs.Completions)
                .Where(c => !string.IsNullOrEmpty(c?.InsertionText))
                .ToList());
     }
 }
コード例 #4
0
        public static IVisualStudioInstance ToMockVs(this SolutionFile self)
        {
            MockVs vs = new MockVs();

            vs.Invoke(() =>
            {
                // HACK: The default targets files require a function that we don't provide
                // The tests are mostly still broken, but they get further now. We should probably
                // move them into UI tests, as we can't emulate the MSBuild environment well enough
                // to open projects from here.
                Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.SetGlobalProperty("NugetRestoreTargets", "false");
                ErrorHandler.ThrowOnFailure(vs.Solution.OpenSolutionFile(0, self.Filename));
            });
            return(vs);
        }
コード例 #5
0
 public int ShowMessageBox(uint dwCompRole, ref Guid rclsidComp, string pszTitle, string pszText, string pszHelpFile, uint dwHelpContextID, OLEMSGBUTTON msgbtn, OLEMSGDEFBUTTON msgdefbtn, OLEMSGICON msgicon, int fSysAlert, out int pnResult)
 {
     pnResult = (int)_instance.Invoke(
         () =>
     {
         MockDialog dialog = new MockMessageBox(_instance, pszTitle, pszText);
         lock (Dialogs)
         {
             Dialogs.Push(dialog);
         }
         dialog.Run();
         lock (Dialogs)
         {
             Dialogs.Pop();
         }
         return(dialog.DialogResult);
     }
         );
     return(VSConstants.S_OK);
 }
コード例 #6
0
 public List <Completion> GetCompletionList(
     int index,
     bool assertIfNoCompletions = true,
     ITextSnapshot snapshot     = null
     )
 {
     snapshot = snapshot ?? CurrentSnapshot;
     if (index < 0)
     {
         index += snapshot.Length + 1;
     }
     View.MoveCaret(new SnapshotPoint(snapshot, index));
     VS.Invoke(() => View.MemberList());
     using (var sh = View.WaitForSession <ICompletionSession>(assertIfNoSession: assertIfNoCompletions)) {
         if (sh == null)
         {
             return(new List <Completion>());
         }
         return(sh.Session.CompletionSets.SelectMany(cs => cs.Completions).ToList());
     }
 }
コード例 #7
0
ファイル: MockVsTestExtensions.cs プロジェクト: omnimark/PTVS
 public static IVisualStudioInstance ToMockVs(this SolutionFile self) {
     MockVs vs = new MockVs();
     vs.Invoke(() => ErrorHandler.ThrowOnFailure(vs.Solution.OpenSolutionFile(0, self.Filename)));
     return vs;
 }
コード例 #8
0
ファイル: MockTreeNode.cs プロジェクト: PeezoSlug/PTVS
 public void DragOntoThis(Key modifier, params ITreeNode[] source)
 {
     _mockVs.Invoke(() => DragOntoThisUIThread(modifier, source));
 }