Extend `GenericCollectionAssertions` to include a `ContainInConsecutiveOrder`
See original GitHub issueDescription
We were writing tests where we needed to check if one collection contained another in order. For this, we used ContainInOrder
.
However, we found that because ContainInOrder
doesn’t check that the items are consecutive we could introduce mutations in the code and our tests would still pass.
To solve this we have made a new method in the same class, GenericCollectionAssertions
, called ContainInConsecutiveOrder
. This is a stricter version of the current check, adding the check that the expected items all appear in consecutive order. For completeness, we also introduced the opposite NotContainInConsecutiveOrder
.
The API change is an extension to the API, with, as far as I can see, no breaking changes.
We have implemented these changes, with associated tests, in a branch and would like to submit a PR.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:10 (10 by maintainers)
Top GitHub Comments
I’m good with
ContainInConsecutiveOrder
.@lg2de Thanks for your perspectives (here and elsewhere in the repo). I’m happy to have your extra set of eyes to ensure we leave no stone unturned.
Although I don’t dislike the proposal, my problem is that we already took a certain (ad-hoc) path where we have distinct methods for distinct goals. If we would have taken this design principle as a starting point, we could have done that. And we still can, but it would be a major breaking change that would require a major review of all APIs to see what they would look like in a major new version. Not only would this require a lot of work and planning, it would also be a major breaking change for our installed base without gaining a lot.