示例#1
0
        public CategoriesControllerTest()
        {
            var options = new DbContextOptionsBuilder <WebShopContext>()
                          .UseInMemoryDatabase("TestDb")
                          .Options;

            _context = new WebShopContext(options);
            TestDbInitializer.Initialize(_context);
            _service    = new WebShopServices(_context);
            _controller = new CategoriesController(_service);
        }
示例#2
0
        public ProductsControllerTest()
        {
            var options = new DbContextOptionsBuilder <WebShopContext>()
                          .EnableSensitiveDataLogging()
                          .UseInMemoryDatabase("TestDb")
                          .Options;

            _context = new WebShopContext(options);
            TestDbInitializer.Initialize(_context);
            _service    = new WebShopServices(_context);
            _controller = new ProductsController(_service);
        }