-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
Function match should catch exception? #1010
Comments
Seems like you really want to use |
Yes, there are some workaround expressions. So we should be careful on match expression as it could raise exception? |
The LINQ |
Well, I think |
If you choose to use a method that may throw over a largely equivalent method that won't throw, fine... it's your code. But it is on you to deal with the consequence of that choice (exceptions being thrown). It is not the Moq library's responsibility to randomly swallow user exceptions. |
Moq version: 4.14.0
When I run test like this, I got an exception, it looks like
Single
method raise exception when a list with two or more elements passed to it.Workaround code:
change
m.Actions.Single() == Action.View
tom.Actions.Count == 1 && m.Actions[0] == Action.View
I'm not sure whether it is possible when match function throws an exception, as a mismatch?
This is my test codes
Exception:
The text was updated successfully, but these errors were encountered: