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

            foreach (var key in _billInventory.Keys)
            {
                balance.Add(key, _billInventory[key]);
            }
            return(balance);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }