-
-
Notifications
You must be signed in to change notification settings - Fork 472
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
Suggest to add an option to assert the correct number of items in a collection to Pester v6 #2534
Comments
It might be another way we are expected to handle this in v6, I added this issue to discuss how the |
My immediate suggestion would be to recommend using It's easy to use, works with @nohwnd: Does the new |
I was thinking
No. We can tell when you pass the value by pipeline, or by parameter, but we cannot distinguish @(1) and 1 when passed by pipeline, because the internal collection does not distinguish that. |
So... Will there be a
Assuming this is already a problem in v5? I would expect that |
I will add -Count to Should-BeCollection, but please start with .Count, it will take me some time. |
Checklist
Summary of the feature request
Currently the new assertions for Pester v6 does not support a way for just asserting the correct number of objects in a collection similar to v5's
Should -HaveCount
. To use commandShould-BeCollection
one must also provide the actual values in the collection for the assert ot work. Suggest to add a parameterSkipValueComparison
orCountOnly
to just assert the correct number of items.How should it work?
Use a switch parameter and use the
Expected
positional parameter for the expected count number.Use a named parameter to also pass the expected count number.
Or add a command
Should-HaveCount
. Example code:The text was updated successfully, but these errors were encountered: