Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid conditionals inside assertions #2751

Closed
Evangelink opened this issue Apr 24, 2024 · 1 comment · Fixed by #2848
Closed

Avoid conditionals inside assertions #2751

Evangelink opened this issue Apr 24, 2024 · 1 comment · Fixed by #2848

Comments

@Evangelink
Copy link
Member

Evangelink commented Apr 24, 2024

Category: Design
Default severity: Info
Enabled by default: true

Use cases: The rule should trigger a diagnostic when a conditional is used inside some assertion (e.g. Assert.AreEqual(a?.B, "ok")) and should recommend to split the call into 2 assertions (e.g. Assert.IsNotNull(a) and then Assert.AreEqual(a.B, "ok")).

AB#2051848

@testplatform-bot
Copy link
Contributor

✅ Successfully linked to Azure Boards work item(s):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants