8000 Ignore CallBase for members of additional interfaces by stakx · Pull Request #583 · devlooped/moq · GitHub
[go: up one dir, main page]

Skip to content

Ignore CallBase for members of additional interfaces - #583

Merged
stakx merged 3 commits into
devlooped:masterfrom
stakx:callbase
Jan 25, 2018
Merged

stakx merged 3 commits into
devlooped:masterfrom
stakx:callbase

Conversation

@stakx
@stakx stakx commented Jan 25, 2018
Copy link
Copy Markdown
Contributor

This fixes #582. (See commit messages for details.)

stakx added 3 commits January 25, 2018 08:24
`CallBase` currently tries to call the base method implementation even
for methods of additional interfaces (i. e. interfaces that were added
to the proxy using `.As<TInterface>()` that the base class does not
implement).
For explicitly implemented interfaces aka `.As<TInterface>()`, there
are actually two subcases to consider wrt to `CallBase`: Reimplemented
and additional interfaces. For the latter, the base class will never
have an implementation, we need to add a check for that.
@stakx
stakx merged commit 60e9b18 into devlooped:master Jan 25, 2018
@stakx
stakx deleted the callbase branch January 25, 2018 07:48
if (!method.LooksLikeEventAttach() && !method.LooksLikeEventDetach())

if (mock.InheritedInterfaces.Contains(declaringType))
{
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add a Debug.Assert(!method.IsAbstract) here someday.

@devlooped devlooped locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NotImplementedException DynamicProxy2 error when CallBase = true while mocking interfaces again

1 participant

0