public void ReduceStockWillReduceListOfCurrentStockByOne()
        {
            var expectedStock = new List <StockItem> {
                new StockItem(VendingStock.Candy, 6), new StockItem(VendingStock.Chips, 0), new StockItem(VendingStock.Pop, 0)
            };

            _stockRepo.AddInventory(VendingStock.Candy, 7);
            var actual = _stockRepo.ReduceStock(VendingStock.Candy, 1);

            CollectionAssert.AreEquivalent(expectedStock, actual);
        }
Пример #2
0
        public int PurchaseItem(VendingStock stock)
        {
            var stockItems = _vendingStockRepository.ReduceStock(stock, ReduceStock);
            var stockItem  = stockItems.Single(x => x.Item == stock);

            return(stockItem.AvailableStock);
        }