public void Include_Two_ProductionAreas() { var id1 = Guid.NewGuid(); var id2 = Guid.NewGuid(); List <ProductionAreas> products = new List <ProductionAreas>() { new ProductionAreas() { Id = id1, Name = "Steira 1", Restrictions = "sugar,oil", Status = true }, new ProductionAreas() { Id = id2, Name = "Steira 1", Restrictions = "sugar,oil", Status = true } }; productionAreaRepository.UpsertRangeAsync(products).Wait(); context.ProductionAreas.Count(x => x.Id == id1 || x.Id == id2).Should().Be(2, "O resultado das áreas de produção deveria ser 2"); }
public async Task InitializeStoreCatalog() { try { await _logServiceBus.SendMessagesAsync("Inicializando..."); var areas = await _productionAreaService.GetProductionAreaAsync(); var products = await _productService.GetProductsAsync(); await _logServiceBus.SendMessagesAsync("Atualizando base de dados..."); await _productRepository.UpsertRangeAsync(products); await _productionAreaRepository.UpsertRangeAsync(areas); await _sendMessageServiceBus.SendStoreCatalogReadyAsync(); await _logServiceBus.SendMessagesAsync("Inicializado com sucesso."); } catch (Exception) { throw; } }