Issue 114 must not be default or empty for immutable array #115
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 #114
This pull request introduces a new assertion method,
MustNotBeDefaultOrEmpty, forImmutableArray<T>in the Light.GuardClauses library. The changes include the implementation of the assertion, unit tests, project file updates, and documentation for the new feature.Implementation of
MustNotBeDefaultOrEmptyforImmutableArray<T>:Code/Light.GuardClauses/Check.MustNotBeDefaultOrEmpty.cs: Added two overloads of theMustNotBeDefaultOrEmptymethod to ensure that anImmutableArray<T>is neither default nor empty. The first overload throws anEmptyCollectionException, while the second allows the caller to provide a custom exception.Unit tests for the new assertion:
Code/Light.GuardClauses.Tests/CollectionAssertions/MustNotBeDefaultOrEmptyTests.cs: Created comprehensive unit tests forMustNotBeDefaultOrEmpty, covering scenarios like default arrays, empty arrays, non-empty arrays, custom exceptions, and custom messages.Project file updates:
Code/Light.GuardClauses/Light.GuardClauses.csproj: Added a reference toSystem.Collections.Immutableversion 8.0.0 to support the new assertion.Documentation for the new feature:
Code/Plans/issue-114-must-not-be-default-or-empty-for-immutable-array.md: Documented the context, tasks, and notes for implementing theMustNotBeDefaultOrEmptyassertion forImmutableArray<T>.