示例#1
0
        public void NullSumCashoutTest()
        {
            var atm   = new CashoutService();
            var money = atm.Cashout(null);

            Assert.Empty(money.Banknotes);
        }
示例#2
0
        public void ImproperNotesCashoutTest()
        {
            var atm = new CashoutService();

            void act() => atm.Cashout(125);

            Assert.Throws <NoteUnavailableException>(act);
        }
示例#3
0
        public void NegativeSumCashoutTest()
        {
            var atm = new CashoutService();

            void act() => atm.Cashout(-130);

            Assert.Throws <InvalidArgumentException>(act);
        }
示例#4
0
        public void ProperNotesCashoutTest(int moneyToCashout, int[] notesExpected)
        {
            var atm   = new CashoutService();
            var money = atm.Cashout(moneyToCashout);
            var notes = money.Banknotes.Select(x => x.Value).ToArray();
            var sum   = money.Banknotes.Sum(x => x.Value);

            Assert.Equal(notesExpected, notes);
            Assert.Equal(moneyToCashout, sum);
        }