diff options
| author | manuel <manuel@mausz.at> | 2011-05-22 17:29:58 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2011-05-22 17:29:58 +0200 |
| commit | 4453374f4e9ae51ea4d9dec4c4407e420e61b72f (patch) | |
| tree | c11b7d7e66aff8727d491cbf3b1b605ed2f64d4c | |
| parent | c34798ced5fa423e3fc448f5b43f55e716d4b925 (diff) | |
| download | foop-4453374f4e9ae51ea4d9dec4c4407e420e61b72f.tar.gz foop-4453374f4e9ae51ea4d9dec4c4407e420e61b72f.tar.bz2 foop-4453374f4e9ae51ea4d9dec4c4407e420e61b72f.zip | |
some stuff..
| -rw-r--r-- | bank-eiffel/account.e | 14 | ||||
| -rw-r--r-- | bank-eiffel/tests/test_account.e | 5 |
2 files changed, 11 insertions, 8 deletions
diff --git a/bank-eiffel/account.e b/bank-eiffel/account.e index 154a1fa..3ef7a8b 100644 --- a/bank-eiffel/account.e +++ b/bank-eiffel/account.e | |||
| @@ -51,8 +51,9 @@ feature {NONE} -- Initialization | |||
| 51 | 51 | ||
| 52 | feature -- Basic operations | 52 | feature -- Basic operations |
| 53 | 53 | ||
| 54 | deposit (an_amount: like transfer_minamount) | 54 | deposit (an_amount: like transfer_minamount; an_authorized_signer: PERSON) |
| 55 | require | 55 | require |
| 56 | an_authorized_signer_authorized: authorized_signers.has (an_authorized_signer) | ||
| 56 | an_amount_positive: an_amount > 0.0 | 57 | an_amount_positive: an_amount > 0.0 |
| 57 | transfer_minamount_ok: an_amount >= transfer_minamount | 58 | transfer_minamount_ok: an_amount >= transfer_minamount |
| 58 | do | 59 | do |
| @@ -62,8 +63,9 @@ feature -- Basic operations | |||
| 62 | deposited: balance = old balance + an_amount | 63 | deposited: balance = old balance + an_amount |
| 63 | end | 64 | end |
| 64 | 65 | ||
| 65 | withdraw (an_amount: like transfer_minamount) | 66 | withdraw (an_amount: like transfer_minamount; an_authorized_signer: PERSON) |
| 66 | require | 67 | require |
| 68 | an_authorized_signer_authorized: authorized_signers.has (an_authorized_signer) | ||
| 67 | an_amount_positive: an_amount > 0.0 | 69 | an_amount_positive: an_amount > 0.0 |
| 68 | transfer_minamount_ok: an_amount >= transfer_minamount | 70 | transfer_minamount_ok: an_amount >= transfer_minamount |
| 69 | do | 71 | do |
| @@ -74,14 +76,12 @@ feature -- Basic operations | |||
| 74 | creditline_ok: balance >= creditline | 76 | creditline_ok: balance >= creditline |
| 75 | end | 77 | end |
| 76 | 78 | ||
| 77 | transfer(an_amount: like transfer_minamount; an_account: like Current) | 79 | transfer(an_amount: like transfer_minamount; an_authorized_signer: PERSON; an_account: like Current; another_authorized_signer: PERSON;) |
| 78 | require | 80 | require |
| 79 | an_amount_positive: an_amount > 0.0 | ||
| 80 | transfer_minamount_ok: an_amount >= transfer_minamount | ||
| 81 | an_account_attached: an_account /= Void | 81 | an_account_attached: an_account /= Void |
| 82 | do | 82 | do |
| 83 | withdraw (an_amount) | 83 | withdraw (an_amount, an_authorized_signer) |
| 84 | an_account.deposit (an_amount) | 84 | an_account.deposit (an_amount, another_authorized_signer) |
| 85 | end | 85 | end |
| 86 | 86 | ||
| 87 | add_authorized_signer (an_authorized_signer: PERSON) | 87 | add_authorized_signer (an_authorized_signer: PERSON) |
diff --git a/bank-eiffel/tests/test_account.e b/bank-eiffel/tests/test_account.e index 7f16cc7..a460023 100644 --- a/bank-eiffel/tests/test_account.e +++ b/bank-eiffel/tests/test_account.e | |||
| @@ -18,10 +18,13 @@ feature -- Test routines | |||
| 18 | CREATE_EDIT_ACCOUNT | 18 | CREATE_EDIT_ACCOUNT |
| 19 | local | 19 | local |
| 20 | person1: PERSON | 20 | person1: PERSON |
| 21 | person2: PERSON | ||
| 21 | account: ACCOUNT | 22 | account: ACCOUNT |
| 22 | do | 23 | do |
| 23 | create person1.make ("SOME_SURNAME", "SOME_FIRSTNAME") | 24 | create person1.make ("SOME_SURNAME_1", "SOME_FIRSTNAME_1") |
| 25 | create person2.make ("SOME_SURNAME_2", "SOME_FIRSTNAME_2") | ||
| 24 | create account.make (person1) | 26 | create account.make (person1) |
| 27 | account.add_authorized_signer (person2) | ||
| 25 | --assert ("not_implemented", False) | 28 | --assert ("not_implemented", False) |
| 26 | end | 29 | end |
| 27 | 30 | ||
