Improve output for expected argument matchers#806
Conversation
957259f to
e4bdaed
Compare
aa3cd12 to
50401f7
Compare
- Add IDescribeSpecification to allow custom arg matchers to provide custom output for "expected to receive" entries. - Fallback to ToString when IDescribeSpecification not implemented. - Update code comment docs accordingly. Relates to nsubstitute#796.
- use string.Empty for null value from IDescribeSpecification, rather than falling back to ToString(). This supports the contract that IDescribeSpecification will be used if implemented. Replacing null string.Empty with matches the documented behaviour of IDescribeNonMatches. - updated IDescribeSpecification code docs. - removed GenericToNonGenericMatcherProxyWithDescribe `ToString` as it can use the GenericToNonGenericMatcherProxy superclass implementation. - update ArgumentSpecification to also support IDescribeSpecification for its matcher. - Replace linq with Array.ConvertAll rather than requiring an extra ToArray conversion.
50401f7 to
72005d0
Compare
zvirja
left a comment
There was a problem hiding this comment.
Looks good to me! Small feature, but could be a good quality of life enhancement
|
One question why do we need |
Yes, I agree it feels like smell. IDK if it is needed, but especially since nullable reference types is enabled in the code and the specified methods are declared to return |
I've merged as-is as the PR is pretty old already, but would be very happy to accept a PR to improve this code. 🙇 |
Closes #796.