예제 #1
0
        protected override async Task AssertContentIsAsync(
            TestWorkspace workspace,
            Document document,
            ITextSnapshot snapshot,
            int position,
            string expectedContent,
            string expectedDocumentationComment = null)
        {
            var provider = CreateProvider(workspace);
            var info     = await provider.GetQuickInfoAsync(new QuickInfoContext(document, position, CancellationToken.None));

            Assert.NotNull(info);
            Assert.NotEqual(0, info.RelatedSpans.Length);

            var trackingSpan       = new Mock <ITrackingSpan>(MockBehavior.Strict);
            var streamingPresenter = workspace.ExportProvider.GetExport <IStreamingFindUsagesPresenter>();
            var quickInfoItem      = await IntellisenseQuickInfoBuilder.BuildItemAsync(trackingSpan.Object, info, snapshot, document, streamingPresenter, CancellationToken.None);

            var containerElement = quickInfoItem.Item as ContainerElement;

            var textElements = containerElement.Elements.OfType <ClassifiedTextElement>();

            Assert.NotEmpty(textElements);

            var textElement = textElements.First();
            var actualText  = string.Concat(textElement.Runs.Select(r => r.Text));

            Assert.Equal(expectedContent, actualText);
        }
예제 #2
0
        protected override async Task AssertContentIsAsync(
            TestWorkspace workspace,
            Document document,
            int position,
            string expectedContent,
            string expectedDocumentationComment = null)
        {
            var provider = CreateProvider();
            var info     = await provider.GetQuickInfoAsync(new QuickInfoContext(document, position, SymbolDescriptionOptions.Default, CancellationToken.None));

            Assert.NotNull(info);
            Assert.NotEqual(0, info.RelatedSpans.Length);

            var trackingSpan       = new Mock <ITrackingSpan>(MockBehavior.Strict);
            var threadingContext   = workspace.ExportProvider.GetExportedValue <IThreadingContext>();
            var operationExecutor  = workspace.ExportProvider.GetExportedValue <IUIThreadOperationExecutor>();
            var streamingPresenter = workspace.ExportProvider.GetExport <IStreamingFindUsagesPresenter>();
            var quickInfoItem      = await IntellisenseQuickInfoBuilder.BuildItemAsync(
                trackingSpan.Object, info, document,
                ClassificationOptions.Default, threadingContext, operationExecutor,
                AsynchronousOperationListenerProvider.NullListener,
                streamingPresenter, CancellationToken.None);

            var containerElement = quickInfoItem.Item as ContainerElement;

            var textElements = containerElement.Elements.OfType <ClassifiedTextElement>();

            Assert.NotEmpty(textElements);

            var textElement = textElements.First();
            var actualText  = string.Concat(textElement.Runs.Select(r => r.Text));

            Assert.Equal(expectedContent, actualText);
        }