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.ReplaceEmptySpan(theory, fromData, toData);

            TextSpanParserResult 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);
            }
        }
Exemple #2
0
        public async Task VerifyNoDiagnosticAsync(
            string theory,
            string fromData,
            CodeVerificationOptions options     = null,
            CancellationToken cancellationToken = default(CancellationToken))
        {
            (TextSpan span, string text) = SpanParser.ReplaceEmptySpan(theory, fromData);

            await VerifyNoDiagnosticAsync(
                source : text,
                additionalSources : null,
                options : options,
                cancellationToken).ConfigureAwait(false);
        }
        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.ReplaceEmptySpan(theory, fromData, toData);

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

            TextSpanParserResult 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);
            }
        }