コード例 #1
0
        public static void VerifyRefactoring(
            string sourceTemplate,
            string fixableCode,
            string fixedCode,
            CodeRefactoringProvider refactoringProvider,
            string equivalenceKey            = null,
            bool allowNewCompilerDiagnostics = false)
        {
            (string source, string newSource, TextSpan span) = TextUtility.GetMarkedSpan(sourceTemplate, fixableCode, fixedCode);

            (string source2, List <TextSpan> spans) = TextUtility.GetMarkedSpans(source);

            if (spans != null)
            {
                source = source2;
                span   = spans[0];
            }

            CodeRefactoringVerifier.VerifyRefactoring(
                source: source,
                newSource: newSource,
                span: span,
                refactoringProvider: refactoringProvider,
                language: LanguageNames.CSharp,
                equivalenceKey: equivalenceKey,
                allowNewCompilerDiagnostics: allowNewCompilerDiagnostics);
        }
コード例 #2
0
        public static void VerifyRefactoring(
            string source,
            string[] additionalSources,
            string newSource,
            CodeRefactoringProvider refactoringProvider,
            string equivalenceKey            = null,
            bool allowNewCompilerDiagnostics = false)
        {
            (string source2, List <TextSpan> spans) = TextUtility.GetMarkedSpans(source);

            CodeRefactoringVerifier.VerifyRefactoring(
                source: source2,
                additionalSources: additionalSources,
                newSource: newSource,
                spans: spans,
                refactoringProvider: refactoringProvider,
                language: LanguageNames.CSharp,
                equivalenceKey: equivalenceKey,
                allowNewCompilerDiagnostics: allowNewCompilerDiagnostics);
        }