Exemplo n.º 1
0
        public void 金額種別ごとの合計金額計算(MoneyKind.Kind kind, int addCount, int sum)
        {
            var target = new Jihanki.Cashier.Base.Money(kind);

            target.Add(addCount);
            Assert.AreEqual(target.Sum(), sum);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 取り扱いしているお金かチェック
        /// </summary>
        /// <param name="money"></param>
        /// <returns></returns>
        public bool IsHandling(Base.Money money)
        {
            //指定されたお金が取り扱い金額種別かチェック
            var query = this.handlingMoneyKindList.Contains(money.GetKind());


            return(query);
        }
Exemplo n.º 3
0
        public void お金種別の取り扱い可否を判定テスト(MoneyKind.Kind kind,bool expected)
        {
            var target = new Jihanki.Cashier.HandingMoney();

            var yen = new Money(kind);
            var actual = target.IsHandling(yen);
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void ドリンクが購入可能か判定テスト(MoneyKind.Kind kind,int num,bool expected)
        {
            //お金を投入
            var money = new Money(kind);
            money.Add(num);
            this.target.ReceiptMoney(money);

            var actual = this.target.IsBuy();
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
 /// <summary>
 /// ユーザが挿入したお金の受け入れ
 /// </summary>
 /// <param name="money">投入されたお金</param>
 /// <returns>
 /// 
 /// </returns>
 public void Receipt(Money money)
 {
     //登録されているユーザ投入金Event分実行
     foreach (Action<Money> n in this._receiptEvemt
                                     .GetInvocationList()
                                     .Where(s => s != null))
     {
         n(money);
     }
 }
Exemplo n.º 6
0
 private void initMoney()
 {
     yen1     = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen1);
     yen5     = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen5);
     yen10    = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen10);
     yen50    = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen50);
     yen100   = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen100);
     yen500   = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen500);
     yen1000  = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen1000);
     yen2000  = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen2000);
     yen5000  = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen5000);
     yen10000 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen10000);
 }
Exemplo n.º 7
0
        //----------------------//
        // Add
        //----------------------//


        /// <summary>
        /// ユーザからの投入金を追加
        /// </summary>
        /// <param name="money">投入金額</param>
        public void InputMoneyAdd(Jihanki.Cashier.Base.Money money)
        {
            //取り扱い可能なお金種別かチェック
            using (var handling = new Cashier.HandingMoney())
            {
                //取り扱いしているお金種別
                if (handling.IsHandling(money) == true)
                {
                    //投入額に追加
                    inputMoney.Add(money);

                    return;
                }
            }

            //払い戻し金額に追加
            this.refundMoney.Add(money);
        }
Exemplo n.º 8
0
 private void initMoney()
 {
     yen1 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen1);
     yen5 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen5);
     yen10 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen10);
     yen50 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen50);
     yen100= new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen100);
     yen500= new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen500);
     yen1000 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen1000);
     yen2000 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen2000);
     yen5000 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen5000);
     yen10000 = new Jihanki.Cashier.Base.Money(Jihanki.Cashier.Base.MoneyKind.Kind.Yen10000);
 }
Exemplo n.º 9
0
 /// <summary>
 /// お金を追加
 /// </summary>
 /// <param name="money"></param>
 public void Add(Money money)
 {
     this.stock.Add(money);
 }
Exemplo n.º 10
0
 /// <summary>
 /// ユーザからの投入金の受付
 /// </summary>
 /// <param name="money">投入金</param>
 public void ReceiptMoney(Money money)
 {
     this.receiptMoney.Receipt(money);
 }
Exemplo n.º 11
0
 public void 金額種別ごとの合計金額計算(MoneyKind.Kind kind,int addCount,int sum)
 {
     var target = new Jihanki.Cashier.Base.Money(kind);
     target.Add(addCount);
     Assert.AreEqual(target.Sum(), sum);
 }