As described in #647, HaveExactElements() leaves some internal state once its Match() returns false. The state never gets cleaned afterwards and causes subsequent calls on the instance to return incorrect results. This can be a problem when the matcher is placed inside ContainElement() or any other matchers that reuse and call inner matcher instances multiple times.
This PR fixes the issue by resetting the matcher state at the beginning of the HaveExactElements#Match().
Fixes #647
As described in #647, HaveExactElements() leaves some internal state once its Match() returns false. The state never gets cleaned afterwards and causes subsequent calls on the instance to return incorrect results. This can be a problem when the matcher is placed inside ContainElement() or any other matchers that reuse and call inner matcher instances multiple times.
This PR fixes the issue by resetting the matcher state at the beginning of the HaveExactElements#Match().