public void DropIn(Money money) { if (money.GetType() == typeof(AcceptableMoney)) this.Total += money.Value; else this.Change += money.Value; }
public void Insert(Money money) { if (_acceptor.IsValid(money)) { _moneyPool.Add(money); _insertedAmount += money.Amount; } }
public void DropIn(Money money) { if (money.GetType() == typeof(AcceptableMoney)) { this.DroppedInMoney.Add(money); this.Total += money.Value; } else this.Change.Add(money); }
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)); }
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)); }
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(); } }
public void AddStock(Money money) { _moneyPool.Add(money); }
public MoneyWithRemainder(Money money, int amount) { Money = money; Remainder = amount; }
public ChangeGroup(Money money, int count) { this.money = money; this.Count = count; this.countToDraw = 0; }
public void InsertMoney(Money money) { _moneyStocker.Insert(money); }