Beispiel #1
0
        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);
 }
Beispiel #3
0
 public ProductsController(AwDbContext context)
 {
     _context = context;
 }
Beispiel #4
0
 public ProductRepository(AwDbContext db, IMapper mapper)
 {
     _db     = db;
     _mapper = mapper;
 }
Beispiel #5
0
 private void ResetContext()
 {
     //meant for design time
     _context = new AwDbContextFactory().CreateDbContext(null);
 }