Ejemplo n.º 1
0
        private static void VerifyFixAll(CodeFixRunner runner, Document[] documents, string[] newSources, FixAllScope fixAllScope, int?codeFixIndex, bool allowNewCompilerDiagnostics)
        {
            var solution    = documents.First().Project.Solution;
            var newSolution = runner.ApplyFixAll(solution, fixAllScope, allowNewCompilerDiagnostics, codeFixIndex ?? 0);

            VerifyDocuments(newSolution, documents, newSources);
        }
Ejemplo n.º 2
0
        private void VerifyFixAll(
            string language,
            DiagnosticAnalyzer analyzerOpt,
            CodeFixProvider codeFixProvider,
            string[] oldSources,
            string[] newSources,
            bool allowNewCompilerDiagnostics,
            bool allowUnsafeCode,
            TestValidationMode validationMode)
        {
            var runner = new CodeFixRunner(analyzerOpt, codeFixProvider, validationMode);

            Assert.True(oldSources.Length == newSources.Length, "Length of expected and actual sources arrays must match.");
            Document[] documents = CreateDocuments(oldSources, language, allowUnsafeCode: allowUnsafeCode);
            var        solution  = documents.First().Project.Solution;

            solution = runner.ApplyFixAll(solution, ImmutableArray <TestAdditionalDocument> .Empty, allowNewCompilerDiagnostics);
            VerifyDocuments(solution, documents, newSources);
        }