title: Why use Rhino Mock Stub method?
body: <p>I just started using Rhino mock to set up test cases for my project. What exactly does the <strong>.Return(objToReturn:list)</strong> do ?   </p>
  
  <p>Its only seems to work if I initialize and populate the list then pass it to the mock stub method. I was a assuming I could used the Mock Stub method to populate a list then return that populated list. </p>
  
  <pre><code>....
      private ProductRepository _productRepository;
      private IProductRepository _productRepositoryStub;
  
      [SetUp]
      public void SetUp()
      {
          _productRepository = new ProductRepository();
  
  
          //Testing using Rhino Mocks
          //Generate stub
           _productRepositoryStub = MockRepository.GenerateMock&lt;IProductRepository&gt;();
      }
  
      [Test]
      public void Canquerydb()
      {
          IList list = _productRepository.GetAllProducts();
          _productRepository.Stub(x=&gt; x.GetAllProducts()).Return(list);
          _productRepositoryStub.AssertWasCalled(x =&gt; x.GetAllProducts());
      }
  
  
      /// &lt;summary&gt;
      /// Refaactor and use MockRhino here
      /// &lt;/summary&gt;
      [Test]
      public void can_insert_product()
      {
          IProduct product = new Grains("Cheese Bread", "Dairy grain", 0);
          _productRepository.SaveProduct(product);
          _productRepositoryStub.Stub(x=&gt;x.SaveProduct(product));
          _productRepositoryStub.AssertWasCalled(x =&gt; x.SaveProduct(product));
  
      }
  </code></pre>