public async Task TestFindReferencesSynchronousCall()
        {
            using (var workspace = await TestWorkspace.CreateCSharpAsync("class C { C() { new C(); } }"))
            {
                var findReferencesPresenter = new MockDefinitionsAndReferencesPresenter();

                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.DefinitionsAndReferences, "C", ".ctor");
            }
        }
Beispiel #2
0
        public async Task TestFindReferencesSynchronousCall()
        {
            using (var workspace = await TestWorkspace.CreateCSharpAsync("class C { C() { new C(); } }"))
            {
                var findReferencesPresenter = new MockDefinitionsAndReferencesPresenter();

                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.DefinitionsAndReferences, "C", ".ctor");
            }
        }
        public void TestFindReferencesSynchronousCall()
        {
            using (var workspace = TestWorkspace.CreateCSharp("class C { C() { new C(); } }"))
            {
                var findReferencesPresenter = new MockDefinitionsAndReferencesPresenter();

                var handler = new FindReferencesCommandHandler(
                    TestWaitIndicator.Default,
                    SpecializedCollections.SingletonEnumerable(findReferencesPresenter),
                    SpecializedCollections.EmptyEnumerable <Lazy <IStreamingFindUsagesPresenter> >(),
                    workspace.ExportProvider.GetExports <IAsynchronousOperationListener, FeatureMetadata>());

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

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