Document Assert.Scope() soft assertions and related behaviors#54409
Open
Evangelink wants to merge 2 commits into
Open
Document Assert.Scope() soft assertions and related behaviors#54409Evangelink wants to merge 2 commits into
Evangelink wants to merge 2 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR documents the experimental Assert.Scope() soft-assertions API in the MSTest assertions article, explaining how failures are collected and reported at scope disposal, and calling out key behavioral differences from normal assertions.
Changes:
- Added a new “Soft assertions with
Assert.Scope()” section under The Assert class. - Documented disposal-time failure reporting behavior, postcondition limitations, and value-returning assertion behavior inside a scope.
- Updated the article’s
ms.date.
Show a summary per file
| File | Description |
|---|---|
| docs/core/testing/unit-testing-mstest-writing-tests-assertions.md | Adds documentation for Assert.Scope() soft assertions, including experimental-status guidance and behavioral caveats. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 3
…, unspaced em dashes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
Member
Author
|
Ping @gewarren |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Documents the experimental
Assert.Scope()soft-assertions API and its behaviors in the MSTest assertions article. This API previously had no coverage in dotnet/docs.Added a new
Soft assertions with Assert.Scope()section under The Assert class, covering:Dispose(single failure vs.AggregateExceptionfor multiple).MSTESTEXPdiagnostic note.Assert.Throws*,Assert.ThrowsExactly*,Assert.ContainsSingle) returnnull/defaulton failure inside a scope — don't rely on the return value. (Addresses confusion seen in Assert.Throws<T>() / Assert.ThrowsExactly<T>() returns null when assertion fails inside AssertScope, violating non-nullable return contract microsoft/testfx#9069.)Assert.Fail/Assert.Inconclusivealways throw, even inside a scope.This mirrors the design captured in MSTest RFC 011 (Soft Assertions and Nullability Design).
Related
Internal previews