title: Mocking a list of objects
body: <p>I'm learning how to write unit tests and am a little stuck on using Mocks. I'm using Moq for mocking.  I am using the built in test framework that comes with VS 2012.  I can switch to NUnit if that is better (and would solve my problem).  I have a unit of work pattern setup.  The method I'm testing is for resetting a user's password.  I am telling Moq to return a list of users based on a unique code which is what is called in the method I'm testing:</p>
  
  <pre><code>var mock = new Mock&lt;IUnitOfWork&gt;();
          mock.Setup(u =&gt; u.UserRepository.Get(t =&gt; t.PassResetCode.Equals("test1"), null, "")).Returns(
              new List&lt;User&gt;
          {
              new User { UserId = 4, FirstName = "Test4", LastName = "LastName", Email = "test4@test.com", Salt = salt, Password = pass, AccountConfirmed = true, PassResetCode = "test1", PassResetExpire = new Nullable&lt;DateTime&gt;(DateTime.Now.Add(ts)) },                
          });
  </code></pre>
  
  <p>In the method I'm testing it calls the following:</p>
  
  <pre><code>var users = unitOfWork.UserRepository.Get(u =&gt; u.PassResetCode.Equals(code));
  </code></pre>
  
  <p>As far as I can tell, it is not returning the list of users I'm creating in the test here. Do I need to mock the repository too that is within the Unit of work class?  Or is just mocking the unit of work interface enough?  I can post more of the code if that helps.</p>