partial-mocks

Why does my partial mock have all virtual methods mocked, even if no expectations are set?

早过忘川 提交于 2019-12-11 03:55:16
问题 I have a user control which does some validation in the ValidateChildren method which I would like to test. I have created a partial mock of the user control, but although I am not setting any expectations on the ValidateChildren method, I am simply calling it, it is simply skipped and the code inside the method never executes. To try and understand what is going on I created a simple test, like so: public class Foo { public virtual bool Method1() { throw new NotImplementedException(); }