예제 #1
0
    def test_remove_money_success(self):
        vending_machine = VendingMachine()
        vending_machine.insert_money(238)
        removed, total_balance = vending_machine.remove_money(213)

        self.assertTrue(removed)
        self.assertEqual(25, total_balance)
예제 #2
0
    def test_remove_money_amount_higher_than_balance(self):
        vending_machine = VendingMachine()
        inserted, total_balance = vending_machine.insert_money(23)
        removed, total_balance_after_removal = vending_machine.remove_money(
            total_balance * 2)

        self.assertTrue(removed)
        self.assertEqual(0, total_balance_after_removal)
예제 #3
0
    def test_remove_money_empty_balance(self):
        vending_machine = VendingMachine()
        removed, total_balance = vending_machine.remove_money(89)

        self.assertFalse(removed)
예제 #4
0
    def test_remove_money_negative_amount(self):
        vending_machine = VendingMachine()
        removed, total_balance = vending_machine.remove_money(-124)

        self.assertFalse(removed)