You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, special fake rules are applied for members of System.Object:
Equals(object): returns true if the argument is the same instance as the fake
GetHashCode(): returns the hash code of the fake manager
ToString(): returns a default string representation of the form Faked <faked object type>
However, when the faked type overrides those methods, these rules are not applied, so a default value is returned instead (unless the methods are explicitly configured). This leads to surprising results:
Equals always returns false, so the fake isn't even considered equal to itself
GetHashCode always returns 0
ToString always returns an empty string
Although this behavior makes sense from a technical point of view, there doesn't seem to be any scenario where it's desirable.
The special rules should still be applied even if the fake type overrides System.Object members.
The text was updated successfully, but these errors were encountered:
Prompted by #1774, after internal discussion.
Currently, special fake rules are applied for members of
System.Object
:Equals(object)
: returns true if the argument is the same instance as the fakeGetHashCode()
: returns the hash code of the fake managerToString()
: returns a default string representation of the formFaked <faked object type>
However, when the faked type overrides those methods, these rules are not applied, so a default value is returned instead (unless the methods are explicitly configured). This leads to surprising results:
Equals
always returns false, so the fake isn't even considered equal to itselfGetHashCode
always returns 0ToString
always returns an empty stringAlthough this behavior makes sense from a technical point of view, there doesn't seem to be any scenario where it's desirable.
The special rules should still be applied even if the fake type overrides
System.Object
members.The text was updated successfully, but these errors were encountered: