title: Mock private methods using FakeItEasy
body: <p>I have achieved a solution to mock test the public virtual method using FakeItEasy Framework. Below I have a Test class with Private method and private method cannot be virtual. So please help me t mock the Private method using FakeItEasy Framework</p>
  
  <p><strong>Class To be tested</strong></p>
  
  <pre><code>public class XYZ
  {
      public static int nValue = 0;
  
      private  void AddInetegers()
      {
          int i = 3;
  
          int j = i * 100;
          int k = j * 30 / 100;
  
          Show(String.Format("Value Here {0}", k.ToString()));
  
          nValue = k;
      }
  
      public virtual void Show(string message)
      {
          MessageBox.Show(message);
      }
  }
  </code></pre>
  
  <p><strong>Test Class</strong></p>
  
  <pre><code>[TestMethod]
     public void Test_Using_FakeItEasy()
      {
  
          var instance = A.Fake&lt;XYZ&gt;();
  
          A.CallTo(() =&gt; instance.Show("Hello"));
  
          //A.CallTo(() =&gt; instance.AddInetegers(3)).CallsBaseMethod();
  
          A.CallTo(instance).Where(x =&gt; x.Method.Name.Contains("AddInetegers")).MustHaveHappened();
  
  
          Assert.AreEqual(90, XYZ.nValue);
      }
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>Result Message:    Test method PrjMSTest.Test.Test_Using_FakeItEasy
    threw exception:  FakeItEasy.ExpectationException: </p>
    
    <p>Assertion failed for the following call:<br>
        Any call made to the fake object.<br>
          where x => x.Method.Name.Contains("AddInetegers")<br>
    Expected to find it at least once but no calls were made to the fake  object.</p>
  </blockquote>