summaryrefslogtreecommitdiffstats
path: root/bank-eiffel/tests/test_account.e
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-23 20:37:54 +0200
committermanuel <manuel@mausz.at>2011-05-23 20:37:54 +0200
commit1daf62f05c19e6f96d16d3688055dfd20d89d2b8 (patch)
tree4e79c5894ee9f5c1d350565e6aae2f9dbd31deaa /bank-eiffel/tests/test_account.e
parente03195a9325d2671208efc45f4a4d083664eafe2 (diff)
downloadfoop-1daf62f05c19e6f96d16d3688055dfd20d89d2b8.tar.gz
foop-1daf62f05c19e6f96d16d3688055dfd20d89d2b8.tar.bz2
foop-1daf62f05c19e6f96d16d3688055dfd20d89d2b8.zip
- add tests
- remove notes - fix minamount for subaccounts
Diffstat (limited to 'bank-eiffel/tests/test_account.e')
-rw-r--r--bank-eiffel/tests/test_account.e111
1 files changed, 92 insertions, 19 deletions
diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e
index e1ca892..4430ab0 100644
--- a/bank-eiffel/tests/test_account.e
+++ b/bank-eiffel/tests/test_account.e
@@ -1,12 +1,3 @@
1note
2 description: "[
3 Eiffel tests that can be executed by testing tool.
4 ]"
5 author: "EiffelStudio test wizard"
6 date: "$Date$"
7 revision: "$Revision$"
8 testing: "type/manual"
9
10class 1class
11 TEST_ACCOUNT 2 TEST_ACCOUNT
12 3
@@ -23,11 +14,13 @@ feature -- Test routines
23 account1: ACCOUNT 14 account1: ACCOUNT
24 account2: ACCOUNT 15 account2: ACCOUNT
25 do 16 do
26 create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") 17 create person1.make ("PERSON1", "PERSON1")
27 create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2") 18 create person2.make ("PERSON2", "PERSON2")
28 create person3.make ("SOME_SURNAME_3", "SOME_FIRSTNAME_3") 19 create person3.make ("PERSON3", "PERSON3")
29 20
30 create account1.make (person1, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0]) 21 create account1.make (person1, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
22 assert("CREATE_EDIT_ACCOUNT_MINAMOUNT", account1.transfer_minamount = 2.0)
23
31 assert("CREATE_EDIT_ACCOUNT_SIGNER_1", account1.get_authorized_signers.count = 1) 24 assert("CREATE_EDIT_ACCOUNT_SIGNER_1", account1.get_authorized_signers.count = 1)
32 account1.add_authorized_signer (person2) 25 account1.add_authorized_signer (person2)
33 account1.add_authorized_signer (person2) 26 account1.add_authorized_signer (person2)
@@ -66,20 +59,100 @@ feature -- Test routines
66 59
67 CREATE_STUDENTACCOUNT 60 CREATE_STUDENTACCOUNT
68 local 61 local
69 person: STUDENT 62 student: STUDENT
63 account: STUDENTACCOUNT
64 do
65 create student.make("STUDENT", "STUDENT")
66 create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
67 assert("CREATE_STUDENTACCOUNT", attached {ACCOUNT} account)
68 assert("CREATE_STUDENTACCOUNT_MINAMOUNT", account.transfer_minamount = 1.0)
69 end
70
71 CREATE_STUDENTACCOUNT_ONLY_STUDENTS
72 local
70 account: STUDENTACCOUNT 73 account: STUDENTACCOUNT
74 student: STUDENT
75 person: PERSON
76 retiree: RETIREE
77 retry_count: INTEGER
71 do 78 do
72 create person.make("SOME_SURNAME", "SOME_FIRSTNAME") 79 create student.make("STUDENT", "STUDENT")
73 create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0]) 80 create person.make("PERSON", "PERSON")
81 create retiree.make("RETIREE", "RETIREE")
82
83 if retry_count = 0 then
84 create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
85 assert("CREATE_STUDENTACCOUNT_ONLY_STUDENTS_1", False)
86 elseif retry_count = 1 then
87 create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
88 assert("CREATE_STUDENTACCOUNT_ONLY_STUDENTS_2", False)
89 elseif retry_count = 2 then
90 create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
91 account.add_authorized_signer (create {STUDENT}.make("STUDENT2", "STUDENT2"))
92 assert("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_1", False)
93 elseif retry_count = 3 then
94 create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
95 account.add_authorized_signer (person)
96 assert("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_2", False)
97 elseif retry_count = 4 then
98 create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
99 account.add_authorized_signer (retiree)
100 assert("CREATE_STUDENTACCOUNT_ONE_STUDENT_ONLY_3", False)
101 end
102 rescue
103 if not (create {EXCEPTIONS}).is_developer_exception then
104 retry_count := retry_count + 1
105 retry
106 end
74 end 107 end
75 108
76 CREATE_RETIREEACCOUNT 109 CREATE_RETIREEACCOUNT
77 local 110 local
78 person: RETIREE 111 retiree: RETIREE
79 account: RETIREEACCOUNT 112 account: RETIREEACCOUNT
80 do 113 do
81 create person.make("SOME_SURNAME", "SOME_FIRSTNAME") 114 create retiree.make("RETIREE", "RETIREE")
82 create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0]) 115 create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
116 assert("CREATE_RETIREEACCOUNT", attached {ACCOUNT} account)
117 assert("CREATE_RETIREEACCOUNT_MINAMOUNT", account.transfer_minamount = 1.0)
83 end 118 end
84end
85 119
120
121 CREATE_RETIREEACCOUNT_ONLY_RETIREES
122 local
123 account: RETIREEACCOUNT
124 retiree: RETIREE
125 person: PERSON
126 student: STUDENT
127 retry_count: INTEGER
128 do
129 create retiree.make("RETIREE", "RETIREE")
130 create person.make("PERSON", "PERSON")
131 create student.make("STUDENT", "STUDENT")
132
133 if retry_count = 0 then
134 create account.make(person, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
135 assert("CREATE_RETIREEACCOUNT_ONLY_RETIREES_1", False)
136 elseif retry_count = 1 then
137 create account.make(student, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
138 assert("CREATE_RETIREEACCOUNT_ONLY_RETIREES_2", False)
139 elseif retry_count = 2 then
140 create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
141 account.add_authorized_signer (create {RETIREE}.make("RETIREE2", "RETIREE2"))
142 assert("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_1", False)
143 elseif retry_count = 3 then
144 create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
145 account.add_authorized_signer (person)
146 assert("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_2", False)
147 elseif retry_count = 4 then
148 create account.make(retiree, 0.01, 0.02, -50.0, [0.01, 0.022], [0.01, 0.02], [-100.0, -50.0])
149 account.add_authorized_signer (student)
150 assert("CREATE_RETIREEACCOUNT_ONE_RETIREE_ONLY_3", False)
151 end
152 rescue
153 if not (create {EXCEPTIONS}).is_developer_exception then
154 retry_count := retry_count + 1
155 retry
156 end
157 end
158end