{{ message }}
Allow WithoutMessage when using Should().Throw() and ThrowAsync()#3100
Merged
Merged
Conversation
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.
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
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
f1b1f19 to
3866643
Compare
jnyrup
reviewed
Sep 21, 2025
3866643 to
9ff3e51
Compare
jnyrup
approved these changes
Sep 22, 2025
jnyrup
left a comment
Member
There was a problem hiding this comment.
As missing handling of AssertionScopes also exists in main it's not blocking for merging this PR.
9ff3e51 to
cd0262a
Compare
jnyrup
approved these changes
Sep 23, 2025
This was referenced Oct 23, 2025
This was referenced Jun 24, 2026
Closed
Open
This was referenced Jul 1, 2026
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.

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