moq: When using Setup(), how is equality of method parameters determined?
For a slightly more detailed answer, Moq uses the ConstantMatcher
(link is to current latest version 4.13.1). The implementation of that matcher is
- Use
object.Equals
- If
object.Equals
failed and value implementsIEnumerable
useSequenceEqual<object>
(which usesobject.Equals
for each element) - If both of the above failed return
false
The answer to my question is that Moq uses .Equals
to determine whether parameters to set up methods are equal.