Beispiel #1
0
        public void TestFindReferencesSynchronousCall()
        {
            using (var workspace = CSharpWorkspaceFactory.CreateWorkspaceFromLines("class C { C() { new C(); } }"))
            {
                var findReferencesPresenter = new MockReferencedSymbolsPresenter();

                var handler = new FindReferencesCommandHandler(
                    TestWaitIndicator.Default,
                    SpecializedCollections.SingletonEnumerable(findReferencesPresenter));

                var textView = workspace.Documents[0].GetTextView();
                textView.Caret.MoveTo(new SnapshotPoint(textView.TextSnapshot, 7));
                handler.ExecuteCommand(new FindReferencesCommandArgs(
                                           textView,
                                           textView.TextBuffer), () => { });

                AssertResult(findReferencesPresenter.Result, "C", ".ctor");
            }
        }
        public async Task TestFindReferencesSynchronousCall()
        {
            using (var workspace = await TestWorkspace.CreateCSharpAsync("class C { C() { new C(); } }"))
            {
                var findReferencesPresenter = new MockReferencedSymbolsPresenter();

                var handler = new FindReferencesCommandHandler(
                    TestWaitIndicator.Default,
                    SpecializedCollections.SingletonEnumerable(findReferencesPresenter));

                var textView = workspace.Documents[0].GetTextView();
                textView.Caret.MoveTo(new SnapshotPoint(textView.TextSnapshot, 7));
                handler.ExecuteCommand(new FindReferencesCommandArgs(
                    textView,
                    textView.TextBuffer), () => { });

                AssertResult(findReferencesPresenter.Result, "C", ".ctor");
            }
        }