public BuyerAI(Buyer buyer, ISupermarketRepository supermarketRepository, IShelfSelectionAlgorithm shelfSelectionAlgorithm, ICashboxSelectionAlgorithm cashboxSelectionAlgorithm) { if (buyer == null) { throw new ArgumentNullException(nameof(buyer)); } if (supermarketRepository == null) { throw new ArgumentNullException(nameof(supermarketRepository)); } if (shelfSelectionAlgorithm == null) { throw new ArgumentNullException(nameof(shelfSelectionAlgorithm)); } if (cashboxSelectionAlgorithm == null) { throw new ArgumentNullException(nameof(cashboxSelectionAlgorithm)); } Buyer = buyer; _supermarketRepository = supermarketRepository; _shelfSelectionAlgorithm = shelfSelectionAlgorithm; _cashboxSelectionAlgorithm = cashboxSelectionAlgorithm; _manualResetEvent = new ManualResetEvent(false); }
static void Main(string[] args) { _supermarketRepository = new SupermarketRepository(); var supermarketProvider = new SupermarketProvider(); var productSpecProvider = new ProductSpecificationsProvider(); _buyerProvider = new BuyerProvider(); _shelfSelectionAlgorithm = new ShelfSelectionAlgorithm(); _cashboxSelectionAlgorithm = new CashboxSelectionAlgorithm(); _supermarket = supermarketProvider.Provide(productSpecProvider.Provide(30), 5); _supermarketRepository.Save(_supermarket); EnterBuyers(10); Console.ReadLine(); }