Exemplo n.º 1
0
 private void ProcessTakeProducts()
 {
     while (!Buyer.ShoppingList.IsCompleted)
     {
         var shelf = _shelfSelectionAlgorithm.PickUp(Supermarket, Buyer.ShoppingList);
         _manualResetEvent.Reset();
         Supermarket.ToGetInLineToShelf(shelf.Id, Buyer.Id, this);
         _manualResetEvent.WaitOne();
         var products = Supermarket.TakeProductsFromShelf(shelf.Id, Buyer.Id, Buyer.ShoppingList.GetProductsCount(shelf.ProductSpecification), this);
         Buyer.AddToBasket(products);
         Buyer.CompletePosition(shelf.ProductSpecification);
     }
 }