title: Using Moq to verify execution of private methods
body: <p>I want to test the following logic (this is obviously a stripped-down version of my method):</p>
  
  <pre><code>public void myPublicMethod(params) {
  
      if(some_condition)
          privateMethod1();
      else
          privateMethod2();
  } 
  </code></pre>
  
  <p>I have all of the other dependencies in the method mocked out, and I've set this up so that I can guarantee that some_condition is true.  What I want to do is verify that my privateMethod1() is called exactly once, and privateMethod2() is not called at all.  Is this possible to do with Moq?</p>
  
  <p>Here are some notes on the issue:</p>
  
  <ul>
  <li>privateMethod1() and privateMethod2() are within the same class as myPublicMethod, so I can't create a mock object for this class.</li>
  <li>The bodies of privateMethod1/2 both contain many, many dependencies from the class that contains these and myPublicMethod, so breaking out privateMethod1/2 into their own helper class would be prohibitively time-consuming</li>
  </ul>
  
  <p>Any thoughts?  Thanks in advance.  I'm willing to accept that this can't be done, but I'd like to know one way or another.</p>