Skip to content

Fix IsEquivalent on default ImmutableArray throws exception#4850

Merged
stevenaw merged 2 commits into
nunit:mainfrom
yergios:3772-IsEquivalent-ImmutableArray
Oct 6, 2024
Merged

Fix IsEquivalent on default ImmutableArray throws exception#4850
stevenaw merged 2 commits into
nunit:mainfrom
yergios:3772-IsEquivalent-ImmutableArray

Conversation

@yergios

@yergios yergios commented Sep 30, 2024

Copy link
Copy Markdown
Contributor

Fixes the issue (#3772) when trying to compare equivalency of two default(ImmutableArray)s.

Added an early return at the Matches method so that any test which passes EqualityComparer<T>.Default.Equals also passes Is.EquivalentTo().

- Added an early return at the Matches method to handle cases where the
actual collection is default (uninitialized) ImmutableArray.

(#3772)
@Dreamescaper

Copy link
Copy Markdown
Member

Could you please add a test for a case when two default ImmutableArrays are compared?

@stevenaw stevenaw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for your contribution @mr-sergito !
@jnm2 an oversight on my part during our discussion in the issue is how that the current lack of generic support in this constraint makes it harder to use EqualityComparer<T>.Default here.

@stevenaw stevenaw merged commit 0d1d21e into nunit:main Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants