title: Passing Moq mock-objects to constructor
body: <p>I've been using RhinoMocks for a good while, but just started looking into Moq. I have this very basic problem, and it surprises me that this doesn't fly right out of the box. Assume I have the following class definition: </p>
  
  <pre><code>public class Foo
  {
      private IBar _bar; 
      public Foo(IBar bar)
      {
          _bar = bar; 
      }
      ..
  }
  </code></pre>
  
  <p>Now I have a test where I need to Mock the IBar that send to Foo. In RhinoMocks I would simply do it like follows, and it would work just great: </p>
  
  <pre><code>var mock = MockRepository.GenerateMock&lt;IBar&gt;(); 
  var foo = new Foo(mock); 
  </code></pre>
  
  <p>However, in Moq this doesn't seem to work in the same way. I'm doing as follows: </p>
  
  <pre><code>var mock = new Mock&lt;IBar&gt;(); 
  var foo = new Foo(mock); 
  </code></pre>
  
  <p>However, now it fails - telling me "Cannot convert from 'Moq.Mock' to 'IBar'. What am I doing wrong? What is the recommended way of doing this with Moq? </p>