Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Jan 25, 2024
1 parent c2be614 commit 1ed8ce1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
case DiagnosticIdentifiers.ConvertStringConcatToInterpolatedString:
{
CodeAction codeAction = CodeAction.Create(
"Use interpolated string",
"Use string interpolation",
ct => ConvertStringConcatToInterpolatedStringAsync(context.Document, invocation, ct),
GetEquivalenceKey(diagnostic));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,33 @@ void M()
);
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.ConvertStringConcatToInterpolatedString)]
public async Task Test_Verbatim()
{
await VerifyDiagnosticAndFixAsync("""
using System;
class C
{
void M()
{
string s = [|string.Concat(@"Now: ", DateTime.Now, @", Now UTC: ", DateTime.UtcNow)|];
}
}
""", """
using System;
class C
{
void M()
{
string s = @$"Now: {DateTime.Now}, Now UTC: {DateTime.UtcNow}";
}
}
"""
);
}

[Fact, Trait(Traits.Analyzer, DiagnosticIdentifiers.ConvertStringConcatToInterpolatedString)]
public async Task TestNoDiagnostic_SingleArgument()
{
Expand Down

0 comments on commit 1ed8ce1

Please sign in to comment.