Example #1
0
 public void DropIn(Money money)
 {
     if (money.GetType() == typeof(AcceptableMoney))
         this.Total += money.Value;
     else
         this.Change += money.Value;
 }
Example #2
0
 public void Insert(Money money)
 {
     if (_acceptor.IsValid(money))
     {
         _moneyPool.Add(money);
         _insertedAmount += money.Amount;
     }
 }
Example #3
0
 public void DropIn(Money money)
 {
     if (money.GetType() == typeof(AcceptableMoney))
     {
         this.DroppedInMoney.Add(money);
         this.Total += money.Value;
     }
     else
         this.Change.Add(money);
 }
Example #4
0
        public void CoinMechAcceptAllKindOfCoin()
        {
            CoinMech coinMech = new CoinMech();

            Money JPY50 = new Money(50);
            Money JPY500 = new Money(500);
            coinMech.Inserted(JPY50);
            coinMech.Inserted(JPY500);

            var actual = coinMech.ShowAmount();
            Assert.That(actual,Is.EqualTo(550));
        }
Example #5
0
        public void CoinMechIsInsertedMoney()
        {
            CoinMech coinMech = new CoinMech();

            Money JPY10 = new Money(10);
            Money JPY100 = new Money(100);

            coinMech.Inserted(JPY10);
            coinMech.Inserted(JPY100);

            var actual = coinMech.ShowAmount();
            Assert.That(actual,Is.EqualTo(110));
        }
Example #6
0
 public void Inserted(Money jpy)
 {
     if(jpy.Amount == 10){
         JPY10.Add(jpy);
     }
     if(jpy.Amount == 100){
         JPY100.Add(jpy);
     }
     if(jpy.Amount == 50){
         JPY50.Add(jpy);
     }
     if(jpy.Amount == 500){
         JPY500.Add (jpy);
     }
 }
 public bool IsValid(Money money)
 {
     switch (money.Kind)
     {
         case MoneyKind.Yen10:
         case MoneyKind.Yen50:
         case MoneyKind.Yen100:
         case MoneyKind.Yen500:
         case MoneyKind.Yen1000:
             return true;
         case MoneyKind.Yen1:
         case MoneyKind.Yen5:
         case MoneyKind.Yen5000:
         case MoneyKind.Yen10000:
             return false;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Example #8
0
 public void AddStock(Money money)
 {
     _moneyPool.Add(money);
 }
Example #9
0
 public MoneyWithRemainder(Money money, int amount)
 {
     Money = money;
     Remainder = amount;
 }
Example #10
0
 public ChangeGroup(Money money, int count)
 {
     this.money = money;
     this.Count = count;
     this.countToDraw = 0;
 }
Example #11
0
 public void InsertMoney(Money money)
 {
     _moneyStocker.Insert(money);
 }