private void AddAnalyzerConfigDocumentWithOptions(TestWorkspace workspace, TestParametersOptions options)
        {
            Debug.Assert(options != null);
            var analyzerConfigText = GenerateAnalyzerConfigText(options);

            var newSolution = workspace.CurrentSolution;

            foreach (var project in workspace.Projects)
            {
                Assert.True(PathUtilities.IsAbsolute(project.FilePath));
                var projectRootFilePath = PathUtilities.GetPathRoot(project.FilePath);
                var documentId          = DocumentId.CreateNewId(project.Id);
                newSolution = newSolution.AddAnalyzerConfigDocument(
                    documentId,
                    ".editorconfig",
                    SourceText.From(analyzerConfigText),
                    filePath: Path.Combine(projectRootFilePath, ".editorconfig"));
            }

            var applied = workspace.TryApplyChanges(newSolution);

            Assert.True(applied);
            return;

            string GenerateAnalyzerConfigText(TestParametersOptions options)
            {
                var textBuilder = new StringBuilder();

                // Add an auto-generated header at the top so we can skip this file in expected baseline validation.
                textBuilder.AppendLine(AutoGeneratedAnalyzerConfigHeader);
                textBuilder.AppendLine();
                textBuilder.AppendLine(options.GetEditorConfigText());
                return(textBuilder.ToString());
            }
        }
 internal Task TestAsync(
     string initialMarkup, string expectedMarkup,
     ParseOptions parseOptions,
     CompilationOptions compilationOptions = null,
     int index = 0, TestParametersOptions options = null,
     object fixProviderData      = null,
     CodeActionPriority?priority = null)
 {
     return(TestAsync(
                initialMarkup,
                expectedMarkup,
                new TestParameters(
                    parseOptions, compilationOptions, options, fixProviderData, index, priority)));
 }
 internal Task TestInRegularAndScriptAsync(
     string initialMarkup,
     string expectedMarkup,
     int index = 0,
     CodeActionPriority?priority           = null,
     CompilationOptions compilationOptions = null,
     TestParametersOptions options         = null,
     object fixProviderData    = null,
     ParseOptions parseOptions = null,
     string title = null)
 {
     return(TestInRegularAndScript1Async(
                initialMarkup, expectedMarkup, index,
                new TestParameters(parseOptions, compilationOptions, options, fixProviderData, index, priority, title: title)));
 }
 internal TestParameters(
     ParseOptions parseOptions             = null,
     CompilationOptions compilationOptions = null,
     TestParametersOptions options         = null,
     object fixProviderData = null,
     int index = 0,
     CodeActionPriority?priority             = null,
     bool retainNonFixableDiagnostics        = false,
     bool includeDiagnosticsOutsideSelection = false,
     string title = null)
 {
     this.parseOptions       = parseOptions;
     this.compilationOptions = compilationOptions;
     this.options            = options;
     this.fixProviderData    = fixProviderData;
     this.index    = index;
     this.priority = priority;
     this.retainNonFixableDiagnostics        = retainNonFixableDiagnostics;
     this.includeDiagnosticsOutsideSelection = includeDiagnosticsOutsideSelection;
     this.title = title;
 }
 internal TestParameters WithOptions(TestParametersOptions options)
 => new TestParameters(parseOptions, compilationOptions, options, fixProviderData, index, priority, retainNonFixableDiagnostics, includeDiagnosticsOutsideSelection, title);