public ContactRepositoryTests(ITestOutputHelper output) { _output = output; var dbOptions = new DbContextOptionsBuilder <EvoContactsDbContext>() .UseInMemoryDatabase(databaseName: "EvoContacts-Tests") .Options; _dbContext = new EvoContactsDbContext(dbOptions); var seedContacts = SeedData.Contacts.Where(x => !_dbContext.Contacts.Where(c => !c.IsDeleted).Any(c => c.Email == x.Email)); //Seed missing Contacts if (seedContacts.Any()) { _dbContext.Contacts.AddRange(seedContacts); _dbContext.SaveChanges(); } _contactRepository = new ContactRepository(_dbContext); }
public EfRepository(EvoContactsDbContext context) { _dbContext = context; _dbSet = _dbContext.Set <T>(); }
public ContactRepository(EvoContactsDbContext dbContext) : base(dbContext) { }