def test_dispense_10_has_2_bills_of_5(self): billsStorage = BillsStorage() billsStorage.add_bills(5, 2) billsDispenser = BillsDispenser(billsStorage) bills = billsDispenser.dispense(10) self.assertEqual(len(bills), 1) self.assertEqual(bills[0].value, 5) self.assertEqual(bills[0].qnt, 2)
def test_dispense_1_has_1_bill_of_1(self): billsStorage = BillsStorage() billsStorage.add_bills(1, 1) billsDispenser = BillsDispenser(billsStorage) bills = billsDispenser.dispense(1) self.assertEqual(len(bills), 1) self.assertEqual(bills[0].value, 1) self.assertEqual(bills[0].qnt, 1) self.assertEqual(billsStorage.get_available_qnt(1), 0)
def test_dispense_20_has_2_bills_of_5_and_2_bills_of_10(self): billsStorage = BillsStorage() billsStorage.add_bills(5, 2) billsStorage.add_bills(10, 2) billsDispenser = BillsDispenser(billsStorage) bills = billsDispenser.dispense(20) self.assertEqual(len(bills), 1) self.assertEqual(bills[0].value, 10) self.assertEqual(bills[0].qnt, 2) self.assertEqual(billsStorage.get_available_qnt(5), 2) self.assertEqual(billsStorage.get_available_qnt(10), 0)
def test_dispense_35_has_5_bills_of_5_10_20_50_100(self): billsStorage = BillsStorage() billsStorage.add_bills(5, 5) billsStorage.add_bills(10, 5) billsStorage.add_bills(20, 5) billsStorage.add_bills(50, 5) billsStorage.add_bills(100, 5) billsDispenser = BillsDispenser(billsStorage) bills = billsDispenser.dispense(35) self.assertEqual(len(bills), 3) self.assertEqual(bills[0].value, 5) self.assertEqual(bills[0].qnt, 1) self.assertEqual(bills[1].value, 10) self.assertEqual(bills[1].qnt, 1) self.assertEqual(bills[2].value, 20) self.assertEqual(bills[2].qnt, 1) self.assertEqual(billsStorage.get_available_qnt(5), 4) self.assertEqual(billsStorage.get_available_qnt(10), 4) self.assertEqual(billsStorage.get_available_qnt(20), 4) self.assertEqual(billsStorage.get_available_qnt(50), 5) self.assertEqual(billsStorage.get_available_qnt(100), 5)