Skip to content
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

HaveCount with special cases for 0 or 1 #12

Closed
jnyrup opened this issue Oct 23, 2017 · 1 comment · Fixed by #17
Closed

HaveCount with special cases for 0 or 1 #12

jnyrup opened this issue Oct 23, 2017 · 1 comment · Fixed by #17

Comments

@jnyrup
Copy link
Member

jnyrup commented Oct 23, 2017

This is really just a nice to have.

list.Count().Should().Be(0);
list.Count().Should().Be(1);

are correctly simplified into:

list.Should().HaveCount(0);
list.Should().HaveCount(1);

It would be nice, if they could be simplified directly into the ContainSingle and BeEmpty instead.

list.Should().ContainSingle();
list.Should().BeEmpty();
@Meir017
Copy link
Member

Meir017 commented Oct 23, 2017

right now it takes to code-fixes to get there since list.Should().HaveCount(0); triggers CollectionShouldBeEmptyAnalyzer that suggests list.Should().BeEmpty();.

it will be available next release

Meir017 added a commit that referenced this issue Oct 25, 2017
Meir017 added a commit that referenced this issue Oct 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants