summaryrefslogtreecommitdiffstats
path: root/bank-eiffel/tests/test_account.e
blob: e1ca8929566f7b3c132bc2b1e729db2007edf41a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
note
	description: "[
		Eiffel tests that can be executed by testing tool.
	]"
	author: "EiffelStudio test wizard"
	date: "$Date$"
	revision: "$Revision$"
	testing: "type/manual"

class
	TEST_ACCOUNT

inherit
	EQA_TEST_SET

feature -- Test routines

	CREATE_EDIT_ACCOUNT
		local
			person1: PERSON
			person2: PERSON
			person3: PERSON
			account1: ACCOUNT
			account2: ACCOUNT
		do
			create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1")
			create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2")
			create person3.make ("SOME_SURNAME_3", "SOME_FIRSTNAME_3")

			create account1.make (person1, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
			assert("CREATE_EDIT_ACCOUNT_SIGNER_1", account1.get_authorized_signers.count = 1)
			account1.add_authorized_signer (person2)
			account1.add_authorized_signer (person2)
			account1.add_authorized_signer (person3)
			account1.remove_authorized_signer (person3)
			assert("CREATE_EDIT_ACCOUNT_SIGNER_2", account1.get_authorized_signers.count = 2)

			assert("CREATE_EDIT_ACCOUNT_BALANCE_1", account1.balance = 0.0)
			account1.deposit (50.0, person1)
			account1.deposit (50.0, person2)
			-- balance = 100.0
			account1.advance
			-- balance = 100.0 + 1% deposit
			account1.withdraw (100.0 + 100.0 * 0.01 + 50.0, person1)
			-- balance = -50.0
			account1.creditline := -100.0
			account1.withdraw (50.0, person1)
			-- balance = -100.0
			account1.advance
			-- balance = -100.0 + 2% debit
			assert("CREATE_EDIT_ACCOUNT_BALANCE_2", account1.balance = -102.0)

			create account2.make(person3, 0.01, 0.02, -50, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
			account2.deposit (102.0, person3)
			account2.transfer (102.0, person3, account1, person1)
			assert("CREATE_EDIT_ACCOUNT_BALANCE_3", account1.balance = 0.0 and account2.balance = 0.0)

			account1.interest_deposit := 0.01
			account1.interest_deposit := 0.022
			account1.interest_debit := 0.01
			account1.interest_debit := 0.02
			account1.creditline := -100.0
			account1.creditline := -50.0
			account1.transfer_minamount := 10.0
		end

	CREATE_STUDENTACCOUNT
		local
			person: STUDENT
			account: STUDENTACCOUNT
		do
			create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
			create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
		end

	CREATE_RETIREEACCOUNT
		local
			person: RETIREE
			account: RETIREEACCOUNT
		do
			create person.make("SOME_SURNAME", "SOME_FIRSTNAME")
			create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
		end
end