Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Fix interface bug introduced by 162a543
Browse files Browse the repository at this point in the history
Commit 162a543 introduced a bug by handing over too many interfaces
to Castle's `ProxyGenerator.CreateClassProxy` method. The intention
behind that commit apparently was to enable `mock.As<TInterface>`
even after `mock.Object` has already been called.

That change unfortunately also caused mocked class' methods that im-
plement an interface method to no longer be mocked correctly.

This commit fixes this problem by ensuring that the "internally
implemented" interfaces are not explicitly passed to `.CreateClass-
Proxy` (like it used to be done previously).
  • Loading branch information
stakx committed Jun 19, 2017
1 parent 33a9570 commit 0e3eaf3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Mock.Generic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private void InitializeInstance()
this.instance = (T)proxyFactory.CreateProxy(
typeof(T),
this.Interceptor,
this.ImplementedInterfaces.ToArray(),
this.ImplementedInterfaces.Skip(this.InternallyImplementedInterfaceCount - 1).ToArray(),
this.constructorArguments);
}
});
Expand Down

0 comments on commit 0e3eaf3

Please sign in to comment.