public CustomerServiceTests() { var serviceCollection = new ServiceCollection(); serviceCollection.AddDbContext <DiscountCouponQuestDbContext>(o => o.UseInMemoryDatabase(Guid.NewGuid().ToString())); serviceCollection.AddAutoMapper(Assembly.Load("DiscountCouponQuest.BLL")); var serviceProvider = serviceCollection.BuildServiceProvider(); _discountCouponQuestDbContext = serviceProvider.GetRequiredService <DiscountCouponQuestDbContext>(); _mapper = serviceProvider.GetRequiredService <IMapper>(); _repository = new Repository <Customer>(_discountCouponQuestDbContext); _customersService = new CustomersService(_repository, _mapper); }
public Repository(DiscountCouponQuestDbContext context) { _context = context; _dbSet = context.Set <T>(); }