-
Notifications
You must be signed in to change notification settings - Fork 179
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
In error messages, name the method that we can't intercept on an instance #786
Comments
Makes sense to me. |
We should probably use the CLR format instead (see #1047) |
btw @blairconrad did you intend to omit the namespace? Should it be |
Also, if we're going to change this message, what do you think about dropping the two blank lines and two spaces at the beginning of the message? As far as I can tell, they don't bring any benefit. |
@thomaslevesque, as you say, we should use the CLR format. And namespaces are good. The whitespace is there to make the exception render pretty when the user makes this error:
(You probably know this, and were still thinking they could be dropped.) I think this sort of thing is done in multiple places, and if we were going to start reformatting messages, it might be better to take a look at all of them? |
Actually, I didn't realize this. I guess it makes sense, then. |
This issue was fixed in Release 3.3.0. |
Inspired by a StackOverflow question.
The questioner had the equivalent of
And didn't understand why he was told
The thought was the complaint was about
GetList
, when really it was aboutSingle
.We should say which method (I'd almost hope for something like
Enumerable.Single<TSource>(this IEnumerable<TSource> source)
, but whatever we can get would be great.We could maybe take a cue from
DefaultFakeObjectCallFormatter
, which has very advanced formatting rules based on whether the method is a method or a property and so on, but it's concerned with object calls and we only haveMethodInfo
s available where we build the exception message above (inDefaultInterceptionAsserter.AssertThatMethodCanBeInterceptedOnInstance
), so we'd need to do a little work for a full-fidelity solution.The text was updated successfully, but these errors were encountered: