main
1using Machine.Specifications;
2using presentation.windows.server.domain.accounting;
3
4namespace unit.server.domain.accounting
5{
6 public class SummaryAccountSpecs
7 {
8 [Subject(typeof (SummaryAccount))]
9 public class when_retrieving_the_balance_from_a_summary_account
10 {
11 Establish c = () =>
12 {
13 var cash = DetailAccount.New(Currency.CAD);
14 var credit = DetailAccount.New(Currency.CAD);
15
16 cash.deposit(50, Currency.CAD);
17 credit.deposit(50, Currency.CAD);
18
19 sut = SummaryAccount.New(Currency.CAD);
20 sut.add(cash);
21 sut.add(credit);
22 };
23
24 Because b = () =>
25 {
26 result = sut.balance();
27 };
28
29 It should_sum_the_balance_for_each_detail_account = () =>
30 {
31 result.should_be_equal_to(new Quantity(100.00, Currency.CAD));
32 };
33
34 static Quantity result;
35 static SummaryAccount sut;
36 }
37 }
38}