While using the NuGet NSubstitute 4.3.0 and NSubstitute.Analyzers.CSharp, I am trying to intercept a call as follows.
_someMock = Substitute.For<IInterface>();
_someMock.ReceivedWithAnyArgs().ExtensionMethod(default);
Here actual names are changed for illustration. ExtensionMethod
is an extension method defined on IInterface
. Apparently Nsubstitute.Analyzers.CSharp is generating the following warning.
NS1001: Member ExtensionMethod can not be intercepted. Only interface members and virtual, overriding, and abstract members can be intercepted.
This is understandable as ExtensionMethod
actually is an extension method (and not of one of the permitted types).
However, surprisingly, the desired call gets intercepted exactly as expected. Any ideas?