def test_when_bills_are_unordered(self):
		batch = BatchBill([Bill(25), Bill(10), Bill(15), Bill(10)])
		desk = CashDesk()	
		desk.take_money(batch)
		expected = '10$ bills: 2\n15$ bills: 1\n25$ bills: 1\n'
		
		self.assertEqual(str(desk), expected)
	def test_total_money_when_desk_is_empty(self):
		desk = CashDesk()
		expected = 0

		result = desk.total()

		self.assertEqual(result, expected)
	def test_take_batch(self):
		batch = BatchBill([Bill(5), Bill(10), Bill(15)])
		desk = CashDesk()
		expected_dict = {Bill(5): 1, Bill(10): 1, Bill(15): 1}

		desk.take_money(batch)

		self.assertEqual(desk.get_dict(), expected_dict)
	def test_take_no_bill(self):
		bill = None
		desk = CashDesk()
		expected_dict = {}

		desk.take_money(bill)

		self.assertEqual(desk.get_dict(), expected_dict)
	def test_take_one_bill(self):
		bill = Bill(10)
		desk = CashDesk()
		expected_dict = {Bill(10): 1}

		desk.take_money(bill)

		self.assertEqual(desk.get_dict(), expected_dict)
 def test_take_money_function_by_using_total_batch_test(self):
     values = [10, 20, 50, 100]
     bills = [Bill(value) for value in values]
     batch = BatchBill(bills)
     desk = CashDesk()
     desk.take_money(batch)
     result = desk.total()
     self.assertEqual(result, 180)
	def test_total_money(self):
		batch = BatchBill([Bill(5), Bill(10), Bill(15), Bill(10)])
		desk = CashDesk()	
		desk.take_money(batch)
		expected = 40

		result = desk.total()

		self.assertEqual(result, expected)
	def test_take_more_different_bills_consecutively(self):
		bill1 = Bill(10)
		bill2 = Bill(15)
		desk = CashDesk()
		expected_dict = {Bill(10): 1, Bill(15): 1}

		desk.take_money(bill1)
		desk.take_money(bill2)

		self.assertEqual(desk.get_dict(), expected_dict)
Beispiel #9
0
 def setUp(self):
     self.bill = Bill(10)
     self.cash_desk = CashDesk()
     self.cash_desk.money = [Bill(5), Bill(20)]
Beispiel #10
0
 def test___str___method_with_one_Bill(self):
     desk = CashDesk()
     desk.take_money(Bill(100))
     self.assertEqual(str(desk), '100$ bills - 1\n')
Beispiel #11
0
 def test___str___method_with_not_any_money(self):
     self.assertEqual(str(CashDesk()), '')
Beispiel #12
0
 def test_total_method_without_any_money(self):
     desk = CashDesk()
     self.assertEqual(desk.total(), 0)
 def test_total_fuction(self):
     desk = CashDesk()
     result = desk.total()
     self.assertEqual(result, 0)
 def test_take_money_function_by_using_total_bill_only_test(self):
     bill = Bill(10)
     desk = CashDesk()
     desk.take_money(bill)
     result = desk.total()
     self.assertEqual(result, 10)