Also require strict order for elements in an array when checking subtree
Before this PR ContainSubtree would just reporing some elements were missing, which is not very informative. Now the same logic and messages from BeEquivalentTo are reused, except that extra properties on the SUT are ignored.
When comparing arrays, elements that have a match are skipped for the consecutive elements to compare. Which means that element that are expected multiple times, should really appear multiple times in the SUT, and also the order becomes important.
Before this PR
ContainSubtree
would just reporingsome elements were missing
, which is not very informative. Now the same logic and messages fromBeEquivalentTo
are reused, except that extra properties on the SUT are ignored. When comparing arrays, elements that have a match are skipped for the consecutive elements to compare. Which means that element that are expected multiple times, should really appear multiple times in the SUT, and also the order becomes important.