MustNotContain for immutable array #122
Merged
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]