title: EF. Mocking ICollection
body: <p>I have class model Role:</p>
  
  <pre><code>public partial class Role
  {
      public Role()
      {
          this.Users = new HashSet&lt;User&gt;();
      }
  
      public int Id { get; set; }
      public string RoleName { get; set; }
  
      public virtual ICollection&lt;User&gt; Users { get; set; }
  }
  </code></pre>
  
  <p>while UnitTesting I need to mock it.
  So I have the code:</p>
  
  <pre><code>public class RoleControllerTest
  {
      private IUnitOfWork fakeRepo;
      [TestInitialize]
      public void Initialize()
      {
          Mock&lt;IUnitOfWork&gt; mock = new Mock&lt;IUnitOfWork&gt;();
          mock.Setup(m =&gt; m.roleRepository.Get(null)).Returns(new[]{
             new Role{Id=1, RoleName="Admin",MissingArgument},
             new Role{Id=2,RoleName="User",MissingArgument}
          });
      }
  }
  </code></pre>
  
  <p>I don't have idea how to mock</p>
  
  <pre><code>public virtual ICollection&lt;User&gt; Users { get; set; }
  </code></pre>
  
  <p>Tried null but this alsa returns error.
  Can you suggest me what variable and what type I should pass in place of <code>MissingArgument</code>?</p>