title: Mock a method with bool as argument and return a 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 the methode <code>GetList</code>, this method receive a <code>bool</code> as parameter. I'd like in return the <code>IUser</code> list where <code>IsValid</code> is true.</p>
  
  <p>I tried this :</p>
  
  <pre><code>Mock&lt;IUsers&gt; mockUserRepository = new Mock&lt;IUsers&gt;();
  
  mockUserRepository.Setup(mr =&gt; mr.GetList(It.IsAny&lt;bool&gt;()))
      .Returns((bool i) =&gt; _users.Select(x =&gt; x.IsValid == i));
  </code></pre>
  
  <p>But I get this error : <code>cannot convert List&lt;bool&gt; to List&lt;IUser&gt;</code></p>
  
  <pre><code>class User : IUser
  {
     public bool IsValid { get; set; }
  }
  
  interface IUser
  {
     bool IsValid { get; set; }
  }
  
  interface IUsers
  {
      List&lt;IUser&gt; GetList(bool isActive);
  }
  </code></pre>