main
 1using Machine.Specifications;
 2using solidware.financials.service.domain.accounting;
 3
 4namespace specs.unit.service.domain.accounting
 5{
 6    public class SummaryAccountSpecs
 7    {
 8        public abstract class concern
 9        {
10            Establish context = () =>
11            {
12                sut = SummaryAccount.New(Currency.CAD);
13            };
14
15            static protected SummaryAccount sut;
16        }
17
18        [Concern(typeof (SummaryAccount))]
19        public class when_retrieving_the_balance_from_a_summary_account : concern
20        {
21            Establish c = () =>
22            {
23                cash = DetailAccount.New(Currency.CAD);
24                credit = DetailAccount.New(Currency.CAD);
25
26                cash.deposit(50, Currency.CAD);
27                credit.deposit(50, Currency.CAD);
28            };
29
30            Because b = () =>
31            {
32                sut.add(cash);
33                sut.add(credit);
34                result = sut.balance();
35            };
36
37            It should_sum_the_balance_for_each_detail_account = () =>
38            {
39                result.should_be_equal_to(new Quantity(100.00m, Currency.CAD));
40            };
41
42            static Quantity result;
43            static DetailAccount cash;
44            static DetailAccount credit;
45        }
46    }
47}