-
Notifications
You must be signed in to change notification settings - Fork 731
Allow WithoutMessage when using Should().Throw() and ThrowAsync() #3100
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
Allow WithoutMessage when using Should().Throw() and ThrowAsync() #3100
Conversation
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
c083348 to
e4789f3
Compare
Pull Request Test Coverage Report for Build 17926661819Details
💛 - Coveralls |
e4789f3 to
01a1bd3
Compare
01a1bd3 to
f1b1f19
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new WithoutMessage method to FluentAssertions that validates an exception message does NOT match a given wildcard pattern, providing the inverse functionality to the existing WithMessage method.
- Adds
WithoutMessagemethod to both synchronous and asynchronous exception assertions - Refactors internal message assertion logic to use a generic action delegate approach
- Updates error messages from "exception message" to "the exception message" for consistency
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/_pages/releases.md | Documents the new WithoutMessage feature in release notes |
| Tests/FluentAssertions.Specs/Exceptions/ExceptionMessageSpecs.cs | Adds new test file with test cases for the WithoutMessage functionality |
| Tests/FluentAssertions.Specs/Exceptions/OuterExceptionSpecs.cs | Updates test expectations to match new error message format |
| Tests/FluentAssertions.Specs/Exceptions/AggregateExceptionSpecs.cs | Fixes class name from ExceptionAssertionSpecs to AggregateExceptionSpecs |
| Tests/Approval.Tests/ApprovedApi/* | Updates API approval tests to include new WithoutMessage methods |
| Src/FluentAssertions/Specialized/ExceptionAssertions.cs | Implements the core WithoutMessage method and refactors message assertion logic |
| Src/FluentAssertions/ExceptionAssertionsExtensions.cs | Adds async extension method for WithoutMessage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
f1b1f19 to
3866643
Compare
3866643 to
9ff3e51
Compare
jnyrup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As missing handling of AssertionScopes also exists in main it's not blocking for merging this PR.
9ff3e51 to
cd0262a
Compare
This PR adds a new
WithoutMessagemethod to FluentAssertions for exception testing that validates an exception message does NOT match a given wildcard pattern.The implementation adds both synchronous and asynchronous variants of
WithoutMessagethat mirror the existingWithMessagefunctionality, but useNotMatchEquivalentOfinstead ofMatchEquivalentOffor the inverse assertion.The code also refactors the internal message assertion logic to be more generic by accepting an action delegate that defines how to assert against the message, allowing both positive and negative message matching to share the same underlying infrastructure.
Minor improvements include changing the error message identifier from "exception message" to "the exception message" for better readability.
Closes #3093