This repository was archived by the owner on Nov 10, 2026. It is now read-only.
Repository navigation
feat: add WhichReturnVoid filter and ReturnsVoid/ReturnVoid assertions - #276
Merged
Merged
Conversation
|
🚀 Benchmark ResultsDetails
|
WhichReturnVoid filter and ReturnsVoid/ReturnVoid assertions
|
This is addressed in release v1.5.0. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
voidvariant to the return-type filter/assertion family.Because
voidcannot be used as a generic type argument (.WhichReturn<void>()doesn't compile), convention tests like "no public methods in value objects return void" or "all event handlers return void" previouslyrequired raw predicates. This adds first-class support:
.WhichReturnVoid().ReturnsVoid().ReturnVoid()Implementation
Each new method is a thin delegation to the existing type-based API with
typeof(void), reusing all matching logic, descriptions, andOr…chaining:MethodFilters.WhichReturnVoid()→WhichReturn(@this, typeof(void))ThatMethod.ReturnsVoid()→Returns(subject, typeof(void))ThatMethods.ReturnVoid()→Return(subject, typeof(void))(with theIAsyncEnumerableoverload underNET8_0_OR_GREATER, matching the existingReturnfamily)No negated methods were added, consistent with
Returns/Return/WhichReturn, which have none (negation is viaDoesNotComplyWith).Usage
WhichReturnVoid()filter and assertion for methods #236