main
1using System;
2using Gorilla.Commons.Utility;
3using Machine.Specifications;
4using presentation.windows.server.domain;
5using presentation.windows.server.domain.payroll;
6
7namespace unit.server.domain.payroll
8{
9 public class GrantSpecs
10 {
11 public abstract class concern
12 {
13 Establish c = () =>
14 {
15 Calendar.stop(() => new DateTime(2010, 01, 01));
16 sut = Grant.New(120, 10, new One<Twelfth>(), new Monthly());
17 };
18
19 static protected Grant sut;
20 }
21
22 [Subject(typeof (Grant))]
23 public class when_checking_what_the_outstanding_balance_of_a_grant_is : concern
24 {
25 It should_return_the_full_balance_before_the_first_vesting_date = () =>
26 {
27 Calendar.stop(() => new DateTime(2010, 01, 31));
28 sut.balance().should_be_equal_to(120);
29 };
30
31 It should_return_the_unvested_portion_after_the_first_vesting_date = () =>
32 {
33 Calendar.stop(() => new DateTime(2010, 02, 01));
34 sut.balance().should_be_equal_to(110);
35 };
36 }
37
38 [Subject(typeof (Grant))]
39 public class when_checking_what_the_value_of_a_grant_was_in_the_past : concern
40 {
41 Because b = () =>
42 {
43 Calendar.stop(() => january_15);
44 sut.change_unit_price_to(20);
45
46 Calendar.reset();
47 sut.change_unit_price_to(40);
48 result = sut.balance(january_15);
49 };
50
51 It should_return_the_correct_amount = () =>
52 {
53 result.should_be_equal_to(240);
54 };
55
56 static Money result;
57 static Date january_15 = new DateTime(2010, 01, 15);
58 }
59 }
60}