title: HippoMocks - Mock a COM interface in C++?
body: <p><a href="https://www.assembla.com/code/hippomocks/git/nodes/master/HippoMocks/hippomocks.h" rel="nofollow">The latest version of Hippo Mocks</a> (in its Git repository) looks to have added support for COM interfaces. I've tried mocking an ADO connection object; which took some tweaking of Hippo Mocks to build properly (seems the COM version of the code wasn't updated for changes in the rest of Hippo Mocks). I have it building now, but the following test fails:</p>
  
  <pre><code>MockRepository mocks;
  auto pConn = mocks.Mock&lt;ADONS::_Connection&gt;();
  mocks.OnCall(pConn, ADONS::_Connection::AddRef).Return(1);
  
  ADONS::_ConnectionPtr conn = pConn;
  </code></pre>
  
  <p>The very first thing the smart pointer does is <code>AddRef</code> the interface. My mock shouldn't care about reference counting, so I add a call expectation that simply returns <code>1</code>. However, as soon as <code>AddRef</code> gets called, a <code>HippoMocks::NotImplementedException</code> gets thrown.</p>
  
  <p>Has anyone had success with mocking a COM interface with Hippo Mocks?</p>