Exemple #1
0
        public void ImportProducts_SavingProductAndItsImages()
        {
            //arrange
            _productRepository.ClearReceivedCalls();
            _productRepository.ClearSubstitute();
            _imageRepository.ClearReceivedCalls();
            _dataReader.GetJsonFromUrl(Arg.Any <string>()).Returns(_jsonExample);

            //act
            _informationImportService.ImportProducts();

            //assert
            _productRepository.Received(1).Add(Arg.Is <Product>(x => x.Id == _firstProductId));
            _productRepository.Received(3).Add(Arg.Any <Product>());
            _imageRepository.Received(33).Add(Arg.Any <Image>());
        }
Exemple #2
0
        public async Task <ActionResult> OldUI()
        {
            await _informationImportService.ImportProducts();

            var productViewModels = new List <ProductViewModel>();

            foreach (var product in _productRepository.GetAll().Take(10))
            {
                productViewModels.Add(new ProductViewModel(_imageRepository, _priceRepository, product));
            }
            return(View(productViewModels));
        }