Skip to content

Enumerate enumerables to determine emptiness #4120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2022

Conversation

Crown0815
Copy link

The usage of the Count property can lead to unexpected results
if the Count is not in sync with the enumeration.

It makes sense to use the Count on a ICollection since the interface
clearly connects the Count with the enumeration. On any IEnumerable,
this assumption is not always correct, though.

fixes #4111

The usage of the `Count` property can lead to unexpected results
if the `Count` is not in sync with the enumeration.

It makes sense to use the `Count` on a `ICollection` since the interface
clearly connects the `Count` with the enumeration. On any `IEnumerable`,
this assumption is not always correct though.
Copy link
Member

@manfred-brands manfred-brands left a comment

Choose a reason for hiding this comment

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

Thanks @Crown0815, changes look good with a new test case added.

@stevenaw
Copy link
Member

stevenaw commented Jun 1, 2022

Thanks @Crown0815 for the contribution! At a glance this looks good to me too. I hope to be able to do a proper review over the next few days

Copy link
Member

@stevenaw stevenaw left a comment

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 @Crown0815 !

@stevenaw stevenaw merged commit 34a39b3 into nunit:master Jun 5, 2022
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.

Is.Empty constraint on complex collections might hide bugs
3 participants