public static IEnumerable <object[]> GenerateDefineUsagesWithExplicitNumberOfArgs(string template, int numArgs)
        {
            TestFileMarkupParser.GetSpans(template, out _, out ImmutableDictionary <string, ImmutableArray <TextSpan> > spans);
            var spanCount = spans.Sum(pair => string.IsNullOrEmpty(pair.Key) ? 0 : pair.Value.Count());

            var numberOfArguments = template.Count(c => c == '{') - spanCount;

            if (numArgs != -1)
            {
                numberOfArguments = numArgs;
            }

            yield return(new[] { $"LoggerMessage.{GenerateGenericInvocation(numberOfArguments, "DefineScope")}({template});" });

            yield return(new[] { $"LoggerMessage.{GenerateGenericInvocation(numberOfArguments, "Define")}(LogLevel.Information, 42, {template});" });
        }
        protected async Task RunFormattingTestAsync(
            string input,
            string expected,
            int tabSize       = 4,
            bool insertSpaces = true,
            string?fileKind   = null,
            IReadOnlyList <TagHelperDescriptor>?tagHelpers = null,
            bool allowDiagnostics = false)
        {
            // Arrange
            fileKind ??= FileKinds.Component;

            TestFileMarkupParser.GetSpans(input, out input, out ImmutableArray <TextSpan> spans);
            var span = spans.IsEmpty ? new TextSpan(0, input.Length) : spans.Single();

            var source = SourceText.From(input);
            var range  = span.AsRange(source);

            var path = "file:///path/to/Document." + fileKind;
            var uri  = new Uri(path);

            var(codeDocument, documentSnapshot) = CreateCodeDocumentAndSnapshot(source, uri.AbsolutePath, tagHelpers, fileKind, allowDiagnostics);
            var options = new FormattingOptions()
            {
                TabSize      = tabSize,
                InsertSpaces = insertSpaces,
            };

            var formattingService = CreateFormattingService(codeDocument);

            // Act
            var edits = await formattingService.FormatAsync(uri, documentSnapshot, range, options, CancellationToken.None);

            // Assert
            var edited = ApplyEdits(source, edits);
            var actual = edited.ToString();

            new XUnitVerifier().EqualOrDiff(expected, actual);

            if (input.Equals(expected))
            {
                Assert.Empty(edits);
            }
        }
        protected async Task RunFormattingTestAsync(
            string input,
            string expected,
            int tabSize       = 4,
            bool insertSpaces = true,
            string fileKind   = null,
            IReadOnlyList <TagHelperDescriptor> tagHelpers = null)
        {
            // Arrange
            fileKind ??= FileKinds.Component;

            TestFileMarkupParser.GetSpans(input, out input, out ImmutableArray <TextSpan> spans);
            var span = spans.IsEmpty ? new TextSpan(0, input.Length) : spans.Single();

            var source = SourceText.From(input);
            var range  = span.AsRange(source);

            var path = "file:///path/to/document.razor";
            var uri  = new Uri(path);

            var(codeDocument, documentSnapshot) = CreateCodeDocumentAndSnapshot(source, uri.AbsolutePath, tagHelpers, fileKind);
            var options = new FormattingOptions()
            {
                TabSize      = tabSize,
                InsertSpaces = insertSpaces,
            };

            var formattingService = CreateFormattingService(codeDocument);

            // Act
            var edits = await formattingService.FormatAsync(uri, documentSnapshot, range, options, CancellationToken.None);

            // Assert
            var edited = ApplyEdits(source, edits);
            var actual = edited.ToString();

#if GENERATE_BASELINES
            Assert.False(true, "GENERATE_BASELINES is set to true.");
#else
            Assert.Equal(expected, actual, ignoreLineEndingDifferences: true);
#endif
        }