コード例 #1
0
        public void TestEatLunchFromCardBooleanTrue()
        {
            PaymentTerminal terminal = new PaymentTerminal();
            PaymentCard     card     = new PaymentCard(11);

            Assert.AreEqual(true, terminal.EatLunch(card), "Buying coffee should return true if balance is enough");
        }
コード例 #2
0
        public void TestEatLunchFromCardBooleanFalse()
        {
            PaymentTerminal terminal = new PaymentTerminal();
            PaymentCard     card     = new PaymentCard(2);

            Assert.AreEqual(false, terminal.EatLunch(card), "Buying coffee should return false if balance is not enough");
        }
コード例 #3
0
        public void TestEatLunchFromCardNotEnoughMoney()
        {
            PaymentTerminal terminal = new PaymentTerminal();
            PaymentCard     card     = new PaymentCard(10);

            terminal.EatLunch(card);
            Assert.AreEqual(10, card.balance, "Lunch should not decrease the balance if there is not enough money!");
        }
コード例 #4
0
        public void TestEatLunchFromCard()
        {
            PaymentTerminal terminal = new PaymentTerminal();
            PaymentCard     card     = new PaymentCard(11);

            terminal.EatLunch(card);
            Assert.AreEqual(Math.Round(Convert.ToDouble("0.7", System.Globalization.CultureInfo.InvariantCulture), 2), Math.Round(Convert.ToDouble(card.balance, System.Globalization.CultureInfo.InvariantCulture), 2), "Lunch should decrease the balance by 10.3!");
        }