main
1using System;
2using developwithpassion.bdd.contexts;
3using Gorilla.Commons.Testing;
4using MoMoney.Domain.Core;
5
6namespace MoMoney.Domain.Accounting
7{
8 [Concern(typeof (Bill))]
9 public class when_checking_to_see_if_a_new_bill_has_been_paid_for : concerns_for<IBill>
10 {
11 it should_return_false = () => result.should_be_equal_to(false);
12
13 public override IBill create_sut()
14 {
15 return new Bill(enmax, amount_owed, DateTime.Now);
16 }
17
18 context c = () =>
19 {
20 amount_owed = new Money(100);
21 enmax = an<ICompany>();
22 };
23
24 because b = () => { result = sut.is_paid_for(); };
25
26 static bool result;
27 static Money amount_owed;
28 static ICompany enmax;
29 }
30
31 [Concern(typeof (Bill))]
32 public class when_checking_if_a_paid_bill_has_been_paid_for : concerns_for<IBill>
33 {
34 it should_return_true = () => result.should_be_equal_to(true);
35
36
37 context c = () =>
38 {
39 one_hundred_twenty_three_dollars_fourty_five_cents = new Money(123, 45);
40 direct_energy = an<ICompany>();
41 };
42
43 because b = () =>
44 {
45 sut.pay(one_hundred_twenty_three_dollars_fourty_five_cents);
46 result = sut.is_paid_for();
47 };
48
49 public override IBill create_sut()
50 {
51 return new Bill(direct_energy, one_hundred_twenty_three_dollars_fourty_five_cents, DateTime.Now);
52 }
53
54 static Money one_hundred_twenty_three_dollars_fourty_five_cents;
55 static bool result;
56 static ICompany direct_energy;
57 }
58
59 [Concern(typeof (Bill))]
60 public class when_checking_if_two_bills_are_the_same_and_they_are : concerns_for<IBill>
61 {
62 it should_return_true = () => result.should_be_equal_to(true);
63
64
65 context c = () =>
66 {
67 company = an<ICompany>();
68 due_date = new DateTime(2008, 01, 01);
69 };
70
71 because b = () => { result = sut.Equals(new Bill(company, new Money(0), due_date)); };
72
73 public override IBill create_sut()
74 {
75 return new Bill(company, new Money(0), due_date);
76 }
77
78 static ICompany company;
79 static DateTime due_date;
80 static bool result;
81 }
82}