Why am I getting an Exception with the message “Invalid setup on a non-virtual (overridable in VB) member…”?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a unit test where I have to mock a non-virtual method that returns a bool type public class XmlCupboardAccess { public bool IsDataEntityInXmlCupboard(string dataId, out string nameInCupboard, out string refTypeInCupboard, string nameTemplate = null) { return IsDataEntityInXmlCupboard(_theDb, dataId, out nameInCupboard, out refTypeInCupboard, nameTemplate); } } So I have a mock object of XmlCupboardAccess class and I am trying to setup mock for this method in my test case as shown below [TestMethod] Public void Test() { private string