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
Firstly, DefaultValue.Empty is described as: "Default behavior, which generates ... empty array and enumerables ...."
It may be a matter of semantics but I expected something like a List<T> to be also treated as "enumerables" in this context. Depending on point of view, applying this to everything implementing IEnumerable<T> may be too much (should a string be "empty" or "null" in this mode?) but how about everything related to ICollection<T>?
If nothing else, I hope this post will help others who encounter the same issue and wonder how to "make it work" (without explicit Setup for each such method on a mock).
Secondly, SetReturnsDefault - it's currently very "picky" ;)
It would be nice, IMHO, if it automatically supported all derived types... and/or wrapped in a Task, ValueTask.
Steps to Reproduce
This (MSTest-style) test code should explain it all:
I think SetReturnsDefault<T> satisfies specific needs already, without introducing the potential for severe breaking changes if the current behavior were modified. I don't think that will happen.
Describe the Bug
Firstly,
DefaultValue.Empty
is described as: "Default behavior, which generates ... empty array and enumerables ...."It may be a matter of semantics but I expected something like a
List<T>
to be also treated as "enumerables" in this context. Depending on point of view, applying this to everything implementingIEnumerable<T>
may be too much (should astring
be "empty" or "null" in this mode?) but how about everything related toICollection<T>
?If nothing else, I hope this post will help others who encounter the same issue and wonder how to "make it work" (without explicit
Setup
for each such method on a mock).Secondly,
SetReturnsDefault
- it's currently very "picky" ;)It would be nice, IMHO, if it automatically supported all derived types... and/or wrapped in a Task, ValueTask.
Steps to Reproduce
This (MSTest-style) test code should explain it all:
Version Info
Moq v4.20.70
The text was updated successfully, but these errors were encountered: