Exemplo n.º 1
0
        private static async Task GetPreview(
            TestWorkspace workspace,
            CodeRefactoringProvider provider
            )
        {
            var codeActions = new List <CodeAction>();

            RefactoringSetup(
                workspace,
                provider,
                codeActions,
                out var extensionManager,
                out var textBuffer
                );
            var suggestedAction = new CodeRefactoringSuggestedAction(
                workspace.ExportProvider.GetExportedValue <IThreadingContext>(),
                workspace.ExportProvider.GetExportedValue <SuggestedActionsSourceProvider>(),
                workspace,
                textBuffer,
                provider,
                codeActions.First()
                );
            await suggestedAction.GetPreviewAsync(CancellationToken.None);

            Assert.True(extensionManager.IsDisabled(provider));
            Assert.False(extensionManager.IsIgnored(provider));
        }
Exemplo n.º 2
0
        private void DisplayText(TestWorkspace workspace, CodeRefactoringProvider provider)
        {
            var codeActions = new List <CodeAction>();

            RefactoringSetup(workspace, provider, codeActions, out var extensionManager, out var textBuffer);
            var suggestedAction = new CodeRefactoringSuggestedAction(
                workspace.ExportProvider.GetExportedValue <SuggestedActionsSourceProvider>(),
                workspace, textBuffer, provider, codeActions.First());
            var text = suggestedAction.DisplayText;

            Assert.True(extensionManager.IsDisabled(provider));
            Assert.False(extensionManager.IsIgnored(provider));
        }
Exemplo n.º 3
0
        private static void DisplayText(TestWorkspace workspace, CodeRefactoringProvider provider)
        {
            var codeActions = new List <CodeAction>();

            RefactoringSetup(workspace, provider, codeActions, out var extensionManager, out var textBuffer);
            var suggestedAction = new CodeRefactoringSuggestedAction(
                workspace.ExportProvider.GetExportedValue <IThreadingContext>(),
                workspace.ExportProvider.GetExportedValue <SuggestedActionsSourceProvider>(),
                workspace, workspace.CurrentSolution, textBuffer, provider, codeActions.First(), fixAllFlavors: null);

            _ = suggestedAction.DisplayText;
            Assert.True(extensionManager.IsDisabled(provider));
            Assert.False(extensionManager.IsIgnored(provider));
        }
Exemplo n.º 4
0
        private void ActionSets(TestWorkspace workspace, CodeRefactoringProvider provider)
        {
            List <CodeAction>             refactorings = new List <CodeAction>();
            ICodeActionEditHandlerService editHandler;

            EditorLayerExtensionManager.ExtensionManager extensionManager;
            VisualStudio.Text.ITextBuffer textBuffer;
            RefactoringSetup(workspace, provider, refactorings, out editHandler, out extensionManager, out textBuffer);
            var suggestedAction = new CodeRefactoringSuggestedAction(workspace, textBuffer, editHandler, refactorings.First(), provider);
            var actionSets      = suggestedAction.ActionSets;

            Assert.True(extensionManager.IsDisabled(provider));
            Assert.False(extensionManager.IsIgnored(provider));
        }
Exemplo n.º 5
0
        private async Task ActionSets(TestWorkspace workspace, CodeRefactoringProvider provider)
        {
            List <CodeAction>             refactorings = new List <CodeAction>();
            ICodeActionEditHandlerService editHandler;

            EditorLayerExtensionManager.ExtensionManager extensionManager;
            VisualStudio.Text.ITextBuffer textBuffer;
            RefactoringSetup(workspace, provider, refactorings, out editHandler, out extensionManager, out textBuffer);
            var suggestedAction = new CodeRefactoringSuggestedAction(workspace, textBuffer, editHandler, refactorings.First(), provider);
            var actionSets      = await suggestedAction.GetActionSetsAsync(CancellationToken.None).ConfigureAwait(true);

            Assert.True(extensionManager.IsDisabled(provider));
            Assert.False(extensionManager.IsIgnored(provider));
        }
Exemplo n.º 6
0
        private void GetPreview(TestWorkspace workspace, CodeRefactoringProvider provider)
        {
            List <CodeAction>             refactorings = new List <CodeAction>();
            ICodeActionEditHandlerService editHandler;

            EditorLayerExtensionManager.ExtensionManager extensionManager;
            VisualStudio.Text.ITextBuffer textBuffer;
            RefactoringSetup(workspace, provider, refactorings, out editHandler, out extensionManager, out textBuffer);
            var suggestedAction = new CodeRefactoringSuggestedAction(workspace, textBuffer, editHandler, refactorings.First(), provider);

            suggestedAction.GetPreviewAsync(CancellationToken.None).PumpingWaitResult();
            Assert.True(extensionManager.IsDisabled(provider));
            Assert.False(extensionManager.IsIgnored(provider));
        }
Exemplo n.º 7
0
        private async Task ActionSets(TestWorkspace workspace, CodeRefactoringProvider provider)
        {
            var codeActions = new List <CodeAction>();

            EditorLayerExtensionManager.ExtensionManager extensionManager;
            VisualStudio.Text.ITextBuffer textBuffer;
            RefactoringSetup(workspace, provider, codeActions, out extensionManager, out textBuffer);
            var suggestedAction = new CodeRefactoringSuggestedAction(
                workspace.ExportProvider.GetExportedValue <SuggestedActionsSourceProvider>(),
                workspace, textBuffer, provider, codeActions.First());
            var actionSets = await suggestedAction.GetActionSetsAsync(CancellationToken.None);

            Assert.True(extensionManager.IsDisabled(provider));
            Assert.False(extensionManager.IsIgnored(provider));
        }