Example #1
0
        public async Task VerifyRefactoringAsync(
            string source,
            string sourceData,
            string expectedData,
            IEnumerable <string> additionalFiles = null,
            string equivalenceKey = null,
            TestOptions options   = null,
            CancellationToken cancellationToken = default)
        {
            var code = TestCode.Parse(source, sourceData, expectedData);

            Debug.Assert(code.Spans.Length > 0);

            var expected = ExpectedTestState.Parse(code.ExpectedValue);

            var data = new RefactoringTestData(
                code.Value,
                code.Spans.OrderByDescending(f => f.Start).ToImmutableArray(),
                AdditionalFile.CreateRange(additionalFiles),
                equivalenceKey: equivalenceKey);

            await VerifyRefactoringAsync(
                data,
                expected,
                options,
                cancellationToken : cancellationToken);
        }
Example #2
0
        public async Task VerifyNoDiagnosticAsync(
            string source,
            IEnumerable <string> additionalFiles = null,
            TestOptions options = null,
            CancellationToken cancellationToken = default)
        {
            var data = new DiagnosticTestData(
                Descriptor,
                source,
                spans: null,
                additionalFiles: AdditionalFile.CreateRange(additionalFiles));

            await VerifyNoDiagnosticAsync(
                data,
                options : options,
                cancellationToken);
        }
Example #3
0
        internal async Task VerifyDiagnosticAsync(
            string source,
            TextSpan span,
            IEnumerable <string> additionalFiles = null,
            TestOptions options = null,
            CancellationToken cancellationToken = default)
        {
            var data = new DiagnosticTestData(
                Descriptor,
                source,
                ImmutableArray.Create(span),
                additionalFiles: AdditionalFile.CreateRange(additionalFiles));

            await VerifyDiagnosticAsync(
                data,
                options : options,
                cancellationToken : cancellationToken);
        }
Example #4
0
        internal async Task VerifyDiagnosticAsync(
            string source,
            IEnumerable <TextSpan> spans,
            IEnumerable <string> additionalFiles = null,
            TestOptions options = null,
            CancellationToken cancellationToken = default)
        {
            var state = new DiagnosticTestState(
                Descriptor,
                source,
                spans,
                additionalFiles: AdditionalFile.CreateRange(additionalFiles));

            await VerifyDiagnosticAsync(
                state,
                options : options,
                cancellationToken : cancellationToken);
        }
Example #5
0
        public async Task VerifyDiagnosticAsync(
            string source,
            IEnumerable <string> additionalFiles = null,
            TestOptions options = null,
            CancellationToken cancellationToken = default)
        {
            var code = TestCode.Parse(source);

            var data = new DiagnosticTestData(
                Descriptor,
                code.Value,
                code.Spans,
                code.AdditionalSpans,
                additionalFiles: AdditionalFile.CreateRange(additionalFiles));

            await VerifyDiagnosticAsync(
                data,
                options : options,
                cancellationToken : cancellationToken);
        }
Example #6
0
        public async Task VerifyDiagnosticAsync(
            string source,
            string sourceData,
            IEnumerable <string> additionalFiles = null,
            TestOptions options = null,
            CancellationToken cancellationToken = default)
        {
            var code = TestCode.Parse(source, sourceData);

            Debug.Assert(code.Spans.Length > 0);

            var state = new DiagnosticTestState(
                Descriptor,
                source,
                code.Spans,
                code.AdditionalSpans,
                additionalFiles: AdditionalFile.CreateRange(additionalFiles));

            await VerifyDiagnosticAsync(
                state,
                options : options,
                cancellationToken : cancellationToken);
        }