Closed JasonBock closed 8 months ago
Thinking on this further...
I think what I can do is change [MemberIdentifier]
so it only has the identifier. The description will be removed. Then, whenever I need that member description (which is only used for exceptions in the implemented member or in Verify()
, which shouldn't happen :) ), I'll call GetMemberDescription()
on the mock type. This will have to change to create the description at runtime, so....it may not be 100% the same with what I have right now, but that's OK, it just has to be "close enough".
This may make things a bit slower when an exception is thrown, but I'm fine with that, because the exceptions really shouldn't happen anyway. Even if it's "slower", the cost shouldn't be extreme. Plus, this will remove a number of hard-coded strings for each implemented member. If the member is rather large (e.g. lots of parameters or types with large FQNs), that string can get rather large as well.
Describe the solution you'd like I'm wondering if it's necessary to store the method signature in
MemberIdentifier
and exceptions that are thrown by the mock. It wouldn't be a large savings, but it would reduce the code size a bit and help on code gen. Users could use the stack trace for an exception to determine which member the exception was thrown from.