Unit test to verify that a base class method is called
<p>I have a base class:</p>

<pre><code>public abstract class MyBaseClass
{
    protected virtual void Method1()
    {    
    }
} 
</code></pre>

<p>and a derived class:</p>

<pre><code>public class MyDerivedClass : MyBaseClass
{
    public void Method2()
    {
        base.Method1();
    }
}
</code></pre>

<p>I want to write a unit test for <code>Method2</code> to verify that it calls <code>Method1</code> on the base class. I'm using Moq as my mocking library. Is this possible?</p>

<p>I came across a related SO link:</p>

<p><a href="https://stackoverflow.com/questions/1293151/mocking-a-base-class-method-call-with-moq">Mocking a base class method call with Moq</a></p>

<p>in which the 2nd answer suggests it can be achieved by setting <code>CallBase</code> property to true on the mock object. However it's not clear how this would enable the call to the base class method (<code>Method1</code> in the above example) to be verified. </p>

<p>Appreciate any assistance with this.</p>