-
-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loose mock should also return empty for IReadOnlyList<T> #173
Comments
PR link? ;)
|
Oh I'm not sure how to do it without breaking the build for .NET < 4.5 |
Closed #330 as a duplicate of this issue, but there's a relevant discussion there about ways to make Moq more consistent. Simply changing the (long-standing) current behavior of the various default value settings could be dangerous because it could break a lot of existing user code. It might be better to extend the API so it allows custom, configurable default value providers. |
This present issue requests that Neither does it make much sense to just add all collection types because many of them are rarely used (e. g. What's worse, there are actually some old Moq unit tests that ensure Finally, just changing the behaviour or We could introduce a backward compatibility switch for that (via I've realised that I really don't want to make all those API decisions of how exactly To make this a little easier, I've submitted #536, which introduces a new abstract base class See the PR for an example how to create a custom empty default value provider. |
I think the behaviour described at https://github.com/Moq/moq4/wiki/Quickstart#user-content-customizing-mock-behavior and http://www.nudoq.org/#!/Packages/Moq/Moq/MockBehavior/F/Loose
Should also apply to the new .NET 4.5 interfaces
IReadOnlyList<T>
andIReadOnlyCollection<T>
Relevant code: https://github.com/Moq/moq4/blob/92e8ed91820b572a524e7c746d030d673e2295eb/Source/EmptyDefaultValueProvider.cs#L78
The text was updated successfully, but these errors were encountered: