示例#1
0
        public async Task when_the_csv_data_is_imported_it_is_saved_to_the_database()
        {
            //arrange
            await _testClass.ImportItems();

            //assert
            var items = await _context.Items.ToListAsync();

            Assert.Equal(5, items.Count());
        }
        public UserRepositoryTests()
        {
            var options = new DbContextOptionsBuilder <ShoppingCartContext>()
                          .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString())
                          .Options;

            _context        = new ShoppingCartContext(options);
            this._testClass = new UserRepository(_context);
            var importService = new ItemImportService(_context);

            importService.ImportItems().Wait();
        }