Created
May 10, 2014 11:45
-
-
Save gregoryyoung/848b8febc158d7f6a424 to your computer and use it in GitHub Desktop.
Context
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AccountSpecifications | |
| { | |
| const decimal perTransactionFee = 0.99m; | |
| public Specification when_withdrawing_money() | |
| { | |
| var currentBalance = 13.0m; | |
| return new ActionSpecification<AccountContext> | |
| { | |
| On = () => new AccountContext { | |
| Account = new Account(currentBalance), | |
| Command = new WithdrawCommand | |
| { | |
| Amount = 12.00m | |
| } | |
| }, | |
| When = account => account.Handle(cmd), | |
| Expect = | |
| { | |
| account => account.Balance == (currentBalance - cmd.Amount) - perTransactionFee, | |
| account => account.CloseToZeroBalance | |
| }, | |
| }; | |
| } | |
| public class AccountContext { | |
| public Command Command; | |
| public Account Account; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok, I'll have a look. Tnx!