title: Generic Moq Repository - GetById(int i) returns T
body: <p>I have a generic repository and im trying to create a moq implementation for my unit tests. I need to create a GetById method. This is the moq implementation before i decided to convert it to use generics.</p>
  
  <pre><code>mockUserRepository.Setup(r =&gt; r.GetById(It.IsAny&lt;int&gt;()))
  .Returns((int i) =&gt; users.Where(u =&gt; u.Id == i).Single());
  </code></pre>
  
  <p>A generic repository will be used for the MOQ setup</p>
  
  <pre><code>Mock&lt;IRepository&lt;T&gt;&gt; mockRepository
  </code></pre>
  
  <p>A generic list of fakes will be used for the LINQ where clause</p>
  
  <pre><code>List&lt;T&gt; list
  </code></pre>
  
  <p>Can anyone help me convert the method above.</p>