Skip to content

Extend GenericCollectionAssertions to include a ContainInConsecutiveOrder #1956

@StacyCash

Description

@StacyCash

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedAPI was approved, it can be implemented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions