public async Task VerifyRefactoringAsync(
            string theory,
            string fromData,
            string toData,
            string equivalenceKey               = null,
            CodeVerificationOptions options     = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            (TextSpan span, string source, string expected) = SpanParser.ReplaceSpan(theory, fromData, toData);

            SpanParserResult result = SpanParser.GetSpans(source, reverse: true);

            if (result.Spans.Any())
            {
                await VerifyRefactoringAsync(
                    source : result.Text,
                    expected : expected,
                    spans : result.Spans.Select(f => f.Span),
                    equivalenceKey : equivalenceKey,
                    options : options,
                    cancellationToken : cancellationToken).ConfigureAwait(false);
            }
            else
            {
                await VerifyRefactoringAsync(
                    source : source,
                    expected : expected,
                    span : span,
                    equivalenceKey : equivalenceKey,
                    options : options,
                    cancellationToken : cancellationToken).ConfigureAwait(false);
            }
        }
Esempio n. 2
0
        public async Task VerifyNoDiagnosticAsync(
            string theory,
            string fromData,
            CodeVerificationOptions options     = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            (TextSpan span, string text) = SpanParser.ReplaceSpan(theory, fromData);

            await VerifyNoDiagnosticAsync(
                source : text,
                additionalSources : null,
                options : options,
                cancellationToken).ConfigureAwait(false);
        }
Esempio n. 3
0
        public async Task VerifyFixAsync(
            string theory,
            string fromData,
            string toData,
            string equivalenceKey               = null,
            CodeVerificationOptions options     = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            (TextSpan span, string source, string expected) = SpanParser.ReplaceSpan(theory, fromData, toData);

            await VerifyFixAsync(
                source : source,
                expected : expected,
                equivalenceKey : equivalenceKey,
                options : options,
                cancellationToken : cancellationToken).ConfigureAwait(false);
        }
Esempio n. 4
0
        public async Task VerifyDiagnosticAsync(
            string theory,
            string fromData,
            CodeVerificationOptions options     = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            (TextSpan span, string text) = SpanParser.ReplaceSpan(theory, fromData);

            SpanParserResult result = SpanParser.GetSpans(text);

            if (result.Spans.Any())
            {
                await VerifyDiagnosticAsync(result.Text, result.Spans.Select(f => f.Span), options, cancellationToken).ConfigureAwait(false);
            }
            else
            {
                await VerifyDiagnosticAsync(text, span, options, cancellationToken).ConfigureAwait(false);
            }
        }