Пример #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);
        }