Exemplo n.º 1
0
        public IReadOnlyCashTransaction MachineBalance()
        {
            var balance = CashTransaction.Start();

            foreach (var key in _billInventory.Keys)
            {
                balance.Add(key, _billInventory[key]);
            }
            return(balance);
        }
Exemplo n.º 2
0
        public static IReadOnlyCashTransaction DefaultInventory()
        {
            var inventory = CashTransaction.Start();

            inventory.Add(UnitedStatesTender.HundredDollar, 10);
            inventory.Add(UnitedStatesTender.FiftyDollar, 10);
            inventory.Add(UnitedStatesTender.TwentyDollar, 10);
            inventory.Add(UnitedStatesTender.TenDollar, 10);
            inventory.Add(UnitedStatesTender.FiveDollar, 10);
            inventory.Add(UnitedStatesTender.OneDollar, 10);

            return(inventory);
        }
Exemplo n.º 3
0
        public IReadOnlyCashTransaction InventoryByBills(IReadOnlyList <UnitedStatesTender> bills)
        {
            var requestedBillCount = CashTransaction.Start();

            foreach (var requestedBill in bills)
            {
                if (_billInventory.ContainsKey(requestedBill))
                {
                    requestedBillCount.Add(requestedBill, _billInventory[requestedBill]);
                }
                else
                {
                    requestedBillCount.Add(requestedBill, 0);
                }
            }
            return(requestedBillCount);
        }