private GAInsightsDbContext GetSampleData(string db) { var builder = new DbContextOptionsBuilder <GAInsightsDbContext>(); builder.UseInMemoryDatabase(databaseName: db); var options = builder.Options; var context = new GAInsightsDbContext(options); var todos = new List <Todo> { new Todo { Description = "Description 1", Id = 1, Priority = 1, Name = "TODO 1" }, new Todo { Description = "Description 1", Id = 2, Priority = 2, Name = "TODO 2" }, }; context.AddRange(todos); context.SaveChanges(); return(context); }
public GenericRepository(GAInsightsDbContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); }
public UnitOfWork(GAInsightsDbContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); TodoRepository = TodoRepository ?? new GenericRepository <Todo>(_context); }