Merged
Conversation
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request implements the MustNotContain assertion for ImmutableArray<T> in the Light.GuardClauses library to avoid boxing when checking if an immutable array contains a specific item.
- Added two
MustNotContainoverloads forImmutableArray<T>- one with default exception handling and one with custom exception factory - Added comprehensive unit tests covering various scenarios including existing items, non-existing items, empty arrays, custom exceptions, and custom messages
- Created documentation outlining the implementation requirements and rationale
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Code/Plans/issue-116-must-not-contain-for-immutable-array.md | Added implementation plan documenting requirements and context for avoiding boxing with ImmutableArray |
| Code/Light.GuardClauses/Check.MustNotContain.cs | Extended with two MustNotContain overloads for ImmutableArray and added System.Collections.Immutable import |
| Code/Light.GuardClauses.Tests/CollectionAssertions/MustNotContainTests.cs | Added comprehensive unit tests for the new ImmutableArray assertions and System.Collections.Immutable import |
Code/Light.GuardClauses.Tests/CollectionAssertions/MustNotContainTests.cs
Show resolved
Hide resolved
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.
Closes #116
This pull request introduces the
MustNotContainassertion forImmutableArray<T>in the Light.GuardClauses library. The changes include extending theCheck.MustNotContain.csfile with two new overloads for theMustNotContainmethod, adding corresponding unit tests, and documenting the implementation details in a new issue plan file. Below is a breakdown of the most important changes.Feature Addition:
MustNotContainforImmutableArray<T>Production Code Changes:
MustNotContainmethod inCheck.MustNotContain.csto ensureImmutableArray<T>does not contain a specified item. The first overload supports optional parameters (parameterName,message) and throws the defaultExistingItemException. The second overload allows custom exceptions via a delegate.Unit Tests:
MustNotContainTests.csto validate the behavior of the newMustNotContainmethods, including scenarios for items existing, items not existing, empty arrays, custom exceptions, and custom messages.Documentation Update
issue-116-must-not-contain-for-immutable-array.mdto document the context, tasks, and notes related to implementingMustNotContainforImmutableArray<T>. This includes avoiding boxing and adhering to existing library conventions.Minor Updates
System.Collections.Immutablenamespace to bothCheck.MustNotContain.csandMustNotContainTests.csto supportImmutableArray<T>. [1] [2]