-
-
Notifications
You must be signed in to change notification settings - Fork 812
WherePasses and WhereThrows to Linq to Mocks #613
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
Comments
WherePasses:Having a WhereThrows:There is perhaps a case to be made for
From this point onwards, new features should probably be discussed over at the Moq 5 repo.Finally, we've put a freeze on Moq 4's API at this time so that Moq 5 can be made ready for release. After that, I expect that Moq 5 will become the leading project with respect to Moq's API, so if you'd like to implement and merge this new functionality into Moq, perhaps it would be best to deal with this over at https://github/moq/moq (the repo for Moq 5). |
Are you confusing
Potentially a lot of time, if you need to set up a ton of things, but have a void or error-throwing method. (#293 would fix this.)
I don't mind reposting there. |
I am closing this issue, as per the above; we definitely shouldn't put an issue with much potential for follow-up API changes in "mostly-maintenance" Moq 4. |
It would be nice to use Linq to Mocks in the following two scenarios:
WherePasses
Instead of having to always instantiate a strict mock with a void method like so:
It would be nice to have
This could be implemented by creating an internal method
ExpressionPasses<T>(T obj, Expression<Action<T>> expression)
, which can be detected during expression parsing, and then interpreting the above line asInstead of adding
WherePasses
as an extension onIQueryable
, I would expose an inheriting interface specifically for Linq to Mocks (IMockQueryable
?) and add the method to that.WhereThrows
Similarly, for methods that throw simple exceptions,
The text was updated successfully, but these errors were encountered: