Steeltoe
Steeltoe copied to clipboard
Address S2699: Tests should include assertions
Address existing suppressions of S2699: Tests should include assertions in the codebase.
To find existing violations, search for "S2699" in src/Steeltoe.All.sln to find existing suppressions.
To address the violations, choose from the following on a case-by-case basis:
- Adhere to the Arrange-Act-Assert pattern: each test should represent a single scenario, which consists of setup (optional), followed by a single action, followed by assertion(s) on its expected outcome.
- If the test body is empty, implement it or remove it; remove the test project if it contains no tests
- Add missing assertions to verify the expected outcome. If the test covers multiple scenarios, split it up into individual tests.
- Try to avoid asserting just that no exception is thrown, but use the following if needed:
Func<Task> action = async () => await service.StartAsync(default); await action.Should().NotThrowAsync("service should be startable");
- Try to avoid asserting just that no exception is thrown, but use the following if needed:
- ~Suppress the violation in code using
#pragma warning disable/restore, preceded by a justification comment if not obvious~