public void ChangeSignatureCommandDisabledInSubmission()
        {
            var exportProvider = ExportProviderCache
                                 .GetOrCreateExportProviderFactory(
                TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(typeof(InteractiveSupportsFeatureService.InteractiveTextBufferSupportsFeatureService)))
                                 .CreateExportProvider();

            using var workspace = TestWorkspace.Create(XElement.Parse(@"
                <Workspace>
                    <Submission Language=""C#"" CommonReferences=""true"">  
                        class C
                        {
                            void M$$(int x)
                            {
                            }
                        }
                    </Submission>
                </Workspace> "),
                                                       workspaceKind: WorkspaceKind.Interactive,
                                                       exportProvider: exportProvider);
            // Force initialization.
            workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();

            var textView = workspace.Documents.Single().GetTextView();

            var handler = new CSharpChangeSignatureCommandHandler(workspace.GetService <IThreadingContext>());

            var state = handler.GetCommandState(new RemoveParametersCommandArgs(textView, textView.TextBuffer));

            Assert.True(state.IsUnspecified);

            state = handler.GetCommandState(new ReorderParametersCommandArgs(textView, textView.TextBuffer));
            Assert.True(state.IsUnspecified);
        }
        public void ChangeSignatureCommandDisabledInSubmission()
        {
            using var workspace = TestWorkspace.Create(XElement.Parse(@"
                <Workspace>
                    <Submission Language=""C#"" CommonReferences=""true"">  
                        class C
                        {
                            void M$$(int x)
                            {
                            }
                        }
                    </Submission>
                </Workspace> "),
                                                       workspaceKind: WorkspaceKind.Interactive,
                                                       composition: EditorTestCompositions.EditorFeaturesWpf);
            // Force initialization.
            workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();

            var textView = workspace.Documents.Single().GetTextView();

            var handler = new CSharpChangeSignatureCommandHandler(workspace.GetService <IThreadingContext>());

            var state = handler.GetCommandState(new RemoveParametersCommandArgs(textView, textView.TextBuffer));

            Assert.True(state.IsUnspecified);

            state = handler.GetCommandState(new ReorderParametersCommandArgs(textView, textView.TextBuffer));
            Assert.True(state.IsUnspecified);
        }
        public async Task ChangeSignatureCommandDisabledInSubmission()
        {
            var exportProvider = MinimalTestExportProvider.CreateExportProvider(
                TestExportProvider.EntireAssemblyCatalogWithCSharpAndVisualBasic.WithParts(typeof(InteractiveDocumentSupportsFeatureService)));

            using (var workspace = await TestWorkspace.CreateAsync(XElement.Parse(@"
                <Workspace>
                    <Submission Language=""C#"" CommonReferences=""true"">  
                        class C
                        {
                            void M$$(int x)
                            {
                            }
                        }
                    </Submission>
                </Workspace> "),
                                                                   workspaceKind: WorkspaceKind.Interactive,
                                                                   exportProvider: exportProvider))
            {
                // Force initialization.
                workspace.GetOpenDocumentIds().Select(id => workspace.GetTestDocument(id).GetTextView()).ToList();

                var textView = workspace.Documents.Single().GetTextView();

                var handler                     = new CSharpChangeSignatureCommandHandler(TestWaitIndicator.Default);
                var delegatedToNext             = false;
                Func <CommandState> nextHandler = () =>
                {
                    delegatedToNext = true;
                    return(CommandState.Unavailable);
                };

                var state = handler.GetCommandState(new Commands.RemoveParametersCommandArgs(textView, textView.TextBuffer), nextHandler);
                Assert.True(delegatedToNext);
                Assert.False(state.IsAvailable);

                delegatedToNext = false;
                state           = handler.GetCommandState(new Commands.ReorderParametersCommandArgs(textView, textView.TextBuffer), nextHandler);
                Assert.True(delegatedToNext);
                Assert.False(state.IsAvailable);
            }
        }