Ejemplo n.º 1
0
 public virtual bool Validate(IBanknote banknote)
 {
     if (banknote.Currency == Currency && banknote.Value == Value)
     {
         return(true);
     }
     return(_nextHandler != null && _nextHandler.Validate(banknote));
 }
Ejemplo n.º 2
0
        public virtual bool Validate(ref string money, out string banknotes)
        {
            var amount        = int.Parse(money);
            var banknoteCount = amount / Value;

            money = (amount % Value).ToString();
            var cache = banknoteCount == 0 ? "" : $"{Value}x{banknoteCount}";

            if (_nextHandler != null && money != "0")
            {
                if (!_nextHandler.Validate(ref money, out banknotes))
                {
                    return(false);
                }
                cache = cache == "" ? banknotes : cache + " + " + banknotes;
            }

            banknotes = cache;
            return(money == "0");
        }
Ejemplo n.º 3
0
 public bool Validate(int value, Currency currency) => handler.Validate(value, currency);
Ejemplo n.º 4
0
 public bool Validate(string banknote)
 {
     return(_handler.Validate(banknote));
 }
Ejemplo n.º 5
0
 public bool Validate(IBanknote banknote)
 {
     return(_handler.Validate(banknote));
 }
Ejemplo n.º 6
0
 public bool Validate(Banknote banknote) => _handler.Validate(banknote);