public ProductControllerTest() { _mapper = new MapperConfiguration(cfg => { cfg.AddProfile(new AutoMapperProfileConfiguration()); }).CreateMapper(); var optionDomainDb = new DbContextOptionsBuilder <AwDbContext>().UseInMemoryDatabase(databaseName: "Aw_InMemory_Database").Options; _awDbContext = new AwDbContext(optionDomainDb); PrepareData(); _prdtRepo = new ProductRepository(_awDbContext, _mapper); _productController = new ProductController(_prdtRepo); }
private void ResetContext() { _context = new AwDbContextFactory().CreateDbContext(null); }
public ProductsController(AwDbContext context) { _context = context; }
public ProductRepository(AwDbContext db, IMapper mapper) { _db = db; _mapper = mapper; }
private void ResetContext() { //meant for design time _context = new AwDbContextFactory().CreateDbContext(null); }