Sometimes, when we develop according to DDD principles, for aggregates and entities, we implement the equals method to compare instances based only on the identifier, not on all fields.
However, in tests, we'd like to ensure that a collection contains items based on all (or some) fields in addition to the identifier.
With this proposal, we'll be able to do just that with this type of code:
If you agree with this proposal, I could extend this functionality to the IsIterableContainingInOrder and IsIterableContainingInRelativeOrder matchers.
Sometimes, when we develop according to DDD principles, for aggregates and entities, we implement the
equals
method to compare instances based only on the identifier, not on all fields.However, in tests, we'd like to ensure that a collection contains items based on all (or some) fields in addition to the identifier.
With this proposal, we'll be able to do just that with this type of code:
If you agree with this proposal, I could extend this functionality to the
IsIterableContainingInOrder
andIsIterableContainingInRelativeOrder
matchers.