Mocking Entity Framework Core DBContext for unit testing
In my new project, we use EF Core for ORM. We have unit tests for the repository layer where the DbContext is used. I’m going to show how to use in-memory database to create the DbContext. I’ll use the model below for example public class Article { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int ArticleNumber { get; set; } … [Read more…]