NSubstitute icon indicating copy to clipboard operation
NSubstitute copied to clipboard

Docs: fix overridable member documentation

Open dtchepak opened this issue 5 years ago • 1 comments

From https://github.com/nsubstitute/NSubstitute/issues/222#issuecomment-557198534, saying protected virtual is substitutable is misleading. While technically possible (hacky) with the current API, it's not something we encourage and people should not expect to mock these members with NSubstitute.

By overridable we mean public virtual, protected virtual, protected internal virtual, or internal virtual with InternalsVisibleTo attribute applied.

dtchepak avatar Nov 21 '19 22:11 dtchepak

Implementing this and realised it is actually a bit more nuanced. The documentation is referring to real code executing for non-overridable members. This includes code in protected virtual, even if these calls are not (easily) configurable via the NSubstitute API.

Will update the docs to try to reflect this a bit better.

dtchepak avatar Jan 22 '20 09:01 dtchepak