title: Test calls to private methods with moq
body: <p>I have the following method I need to test with Moq. The problem is that each method called in the switch statement is private, including the PublishMessage at the end. But this method (ProcessMessage) is public. How can I test this so that I can ensure the calls are made depending on the parameter? Note that I'm not testing the private methods, I just want to test the "calls". I'd like to mock these private methods and check if they are called using Setup, but Moq does not support mocking private methods.</p>
  
  <pre><code>public void ProcessMessage(DispenserMessageDataContract dispenserMessage)
      {
          var transOptions = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted };
          using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew, transOptions))
          {
              switch (dispenserMessage.Type)
              {
                  case DispenserMessageType.AckNack:
                      UpdateAckNackMessageQueue(dispenserMessage);
                      break;
  
                  case DispenserMessageType.FillRequest:
                      CreateFillRequestMessageQueue(dispenserMessage);
                      break;
  
                  case DispenserMessageType.FillEvent:
                      UpdateFillEventMessageQueue(dispenserMessage);
                      break;
  
                  case DispenserMessageType.RequestInventory:
                      CreateRequestInventoryMessageQueue(dispenserMessage);
                      break;
  
                  case DispenserMessageType.ReceiveInventory:
                      CreateReceiveInventoryMessageQueue(dispenserMessage);
                      break;
              }
  
              scope.Complete();
          }
  
          PublishMessage(dispenserMessage);
      }
  </code></pre>