Skip to content

Commit

Permalink
Merge pull request dotnet#1179 from MattFromRVA/Improve_VerifyCodeFix…
Browse files Browse the repository at this point in the history
…Async_Exception_Message

Improve exception message for VerifyCodeFixAsync
  • Loading branch information
sharwell authored Aug 26, 2024
2 parents 0af0fc3 + e401620 commit bc8a063
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,11 @@ private async Task VerifyProjectAsync(ProjectState newState, Project project, IV

try
{
if (expectedNumberOfIterations >= 0)
if (expectedNumberOfIterations == 0)
{
verifier.Equal(expectedNumberOfIterations, expectedNumberOfIterations - numberOfIterations, "No code fixes were expected, but a fix was offered that made no changes to the code.");
}
else if (expectedNumberOfIterations > 0)
{
verifier.Equal(expectedNumberOfIterations, expectedNumberOfIterations - numberOfIterations, $"Expected '{expectedNumberOfIterations}' iterations but found '{expectedNumberOfIterations - numberOfIterations}' iterations.");
}
Expand Down Expand Up @@ -862,7 +866,11 @@ private async Task VerifyProjectAsync(ProjectState newState, Project project, IV

try
{
if (expectedNumberOfIterations >= 0)
if (expectedNumberOfIterations == 0)
{
verifier.Equal(expectedNumberOfIterations, expectedNumberOfIterations - numberOfIterations, "No code fixes were expected, but a fix was offered that made no changes to the code.");
}
else if (expectedNumberOfIterations > 0)
{
verifier.Equal(expectedNumberOfIterations, expectedNumberOfIterations - numberOfIterations, $"Expected '{expectedNumberOfIterations}' iterations but found '{expectedNumberOfIterations - numberOfIterations}' iterations.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace MyNamespace {|Brace:{|}
Assert.Equal(
"""
Context: Iterative code fix application
Expected '0' iterations but found '1' iterations.
No code fixes were expected, but a fix was offered that made no changes to the code.
""".ReplaceLineEndings(),
exception.Message);

Expand All @@ -91,7 +91,7 @@ namespace MyNamespace {|Brace:{|}
Assert.Equal(
"""
Context: Iterative code fix application
Expected '0' iterations but found '1' iterations.
No code fixes were expected, but a fix was offered that made no changes to the code.
""".ReplaceLineEndings(),
exception.Message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace MyNamespace {
Assert.Equal(
"""
Context: Iterative code fix application
Expected '0' iterations but found '1' iterations.
No code fixes were expected, but a fix was offered that made no changes to the code.
""".ReplaceLineEndings(),
exception.Message);

Expand All @@ -95,7 +95,7 @@ namespace MyNamespace {
Assert.Equal(
"""
Context: Iterative code fix application
Expected '0' iterations but found '1' iterations.
No code fixes were expected, but a fix was offered that made no changes to the code.
""".ReplaceLineEndings(),
exception.Message);
}
Expand Down

0 comments on commit bc8a063

Please sign in to comment.