예제 #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!");
        }