title: Mock a method with List<int> as parameter and return List<> with Moq
body: <p>In my test, I defined as data a <code>List&lt;IUser&gt;</code> with some record in.</p>
  
  <p>I'd like setup a moq for the method GetList, this method receives a <code>List&lt;int&gt;</code> as the parameter. This is a list of Ids; I'd like to return the IUser list with these Ids in the <code>List&lt;IUser&gt;</code></p>
  
  <p>I tried this but I don't find the right Returns syntax</p>
  
  <pre><code>Mock&lt;IUsers&gt; mockUserRepository = new Mock&lt;IUsers&gt;();
  _mockUserRepository.Setup(m =&gt; m.GetListAll(It.IsAny&lt;List&lt;int&gt;&gt;())).Returns(????????);
  </code></pre>
  
  <p>I tried something like this :</p>
  
  <pre><code>_mockUserRepository.Setup(m =&gt; m.GetListAll(It.IsAny&lt;List&lt;int&gt;&gt;())).Returns(u =&gt;_users.Contains(???));
  </code></pre>
  
  <p>Thanks,</p>
  
  <pre><code>class User : IUser
  {
      public int Id { get; set; }
      public string Firsname { get; set; }
      public string Lastname { get; set; }
  }
  
  interface IUser
  {
      int Id { get; set; }
      string Firsname { get; set; }
      string Lastname { get; set; }
  }
  
  interface IAction
  {
      List&lt;IUser&gt; GetList(List&lt;int&gt; listId);
  }
  
  class Action : IAction
  {
  
      public List&lt;IUser&gt; GetList(List&lt;int&gt; listId)
      {
          //....
      }
  }
  </code></pre>