def test_with_given_one_bill_cashdesk_should_return_amount_of_bill(self):
        cashdesk = Cashdesk()
        amount = 10
        cashdesk.take_money(Bill(amount))

        result = cashdesk.total()

        self.assertEqual(result, amount)
    def test_with_given_multi_bill_cashdesk_should_return_amount_of_all_bills(
            self):
        cashdesk = Cashdesk()
        cashdesk.take_money(BillBatch([Bill(i) for i in range(1, 5)]))

        result = cashdesk.total()

        expected = sum(range(1, 5))

        self.assertEqual(result, expected)
    def test_with_given_multi_bill_cashdesk_and_bill_occurs_more_than_ones_should_return_amount_of_all_bills(
            self):
        cashdesk = Cashdesk()
        cashdesk.take_money(Bill(10))
        batch = BillBatch([Bill(i) for i in range(1, 5)])
        cashdesk.take_money(batch)
        cashdesk.take_money(batch)

        result = cashdesk.total()

        expected = sum(range(1, 5)) * 2 + 10

        self.assertEqual(result, expected)
Пример #4
0
 def test_total_zero_when_new_instance_made(self):
     my_cashdesk = Cashdesk()
     self.assertEqual(0, my_cashdesk.total())
Пример #5
0
 def test_total_after_money_take(self):
     my_cashdesk = Cashdesk()
     my_cashdesk.take_money({100: 3, 2: 1})
     self.assertEqual(302, my_cashdesk.total())
    def test_with_given_empty_cashdesk_should_return_zero(self):
        cashdesk = Cashdesk()

        result = cashdesk.total()

        self.assertEqual(result, 0)