This repository was archived by the owner on May 27, 2026. It is now read-only.
fix: add assertion to ParallelCakeEngineTests.Should_Swallow_Exceptions_If_ContinueOnError_Is_Set#2
Open
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AYfoIGTKqfEBxbAAXPMw for csharpsquid:S2699 rule Generated by SonarQube Agent (task: 470ab8c1-12a4-44ce-9f70-1ed3355c6c24)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Added an assertion to verify that no exception is thrown when ContinueOnError is set, fixing a SonarQube blocker issue that required all test cases to contain at least one assertion. This ensures the test properly validates the expected behavior of exception swallowing.
View Project in SonarCloud
Fixed Issues
csharpsquid:S2699 - Add at least one assertion to this test case. • BLOCKER • View issue
Location:
src/Cake.Parallel.Tests/ParallelCakeEngineTests.cs:309Why is this an issue?
The rule targets test methods that lack an assertion and consist solely of an action and, optionally, a setup.
What changed
This hunk fixes the test method 'Should_Swallow_Exceptions_If_ContinueOnError_Is_Set' which previously had no assertions. The original code simply called
await engine.RunTargetAsync(...)without verifying any behavior. The fix wraps the call inRecord.ExceptionAsyncto capture any thrown exception, and then addsAssert.Null(record)to explicitly assert that no exception was thrown. This satisfies the static analysis rule requiring at least one assertion in every test method, ensuring the test meaningfully validates that exceptions are swallowed when ContinueOnError is set.SonarQube Remediation Agent uses AI. Check for mistakes.