title: Testing and mocking private/protected methods. Many posts but still cannot make one example work
body: <p>I have seen many posts and questions about "Mocking a private method" but still cannot make it work and not found a real answer.
  Lets forget the code smell and you should not do it etc....</p>
  
  <p>From what I understand I have done the following:</p>
  
  <p>1) Created a class Library "MyMoqSamples"</p>
  
  <p>2) Added a ref to Moq and NUnit</p>
  
  <p>3) Edited the AssemblyInfo file and added 
        [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
        [assembly: InternalsVisibleTo("MyMoqSamples")]</p>
  
  <p>4) Now need to test a private method.Since it's a private method it's not part of an interface.</p>
  
  <p>5) added the following code</p>
  
  <pre><code>[TestFixture]
  public class Can_test_my_private_method
  {
      [Test]
      public void Should_be_able_to_test_my_private_method()
      {
          // TODO how do I test my DoSomthing method?
      }
  }
  
  public class CustomerInfo
  {
      public string Name { get; set; }
      public string Surname { get; set; }
  }
  
  public interface ICustomerService
  {
      List&lt;CustomerInfo&gt; GetCustomers();
  }
  
  public class CustomerService : ICustomerService
  {
      public List&lt;CustomerInfo&gt; GetCustomers()
      {
          return new List&lt;CustomerInfo&gt; { new CustomerInfo { Surname = "Bloggs", Name = "Jo" } };
      }
  
      protected virtual void DoSomething()
      {
      }
  }
  </code></pre>
  
  <p>Could you provide me an example on how you would test my private method?
  Thanks a lot</p>