title: EF4.1 Code First Mocking With Moq
body: <p>I am trying my hand on EF with EF4.1 Code Frist. I have developed my models, like:</p>
  
  <pre><code>public class User
  {
      [Key]
      public int Id{get;set;}
      [Column("first_name")]
      [StringLength(30)]
      public string FristName{get;set;}
      //............
      //..............
  }
  </code></pre>
  
  <p>I have written an interface also:</p>
  
  <pre><code>public interface IUser
  {
      IDbSet&lt;User&gt; Users{get;}
  }
  </code></pre>
  
  <p>My context class looks like this:</p>
  
  <pre><code>public class UserContext : DbContext, IUser
  {
      public DbSet&lt;User&gt; Users{get;set;}
  
      IDbSet&lt;User&gt; IUser.Users{get return{Users;}}
  }  
  </code></pre>
  
  <p>Now I am at loss how to use Moq to mock this repository and do unit testing. Maybe I am new to unit testing with mocking. </p>
  
  <p>Kindly advise me or point me to some resources where I can learn how to use Moq with EF4.1.</p>