main
 1using System;
 2using Machine.Specifications;
 3using solidware.financials.service.domain;
 4using solidware.financials.service.domain.payroll;
 5
 6namespace specs.unit.service.domain.payroll
 7{
 8    public class CompensationSpecs
 9    {
10        public abstract class concern 
11        {
12            Establish context = () =>
13            {
14                sut = new Compensation();
15            };
16
17            static protected Compensation sut;
18        }
19
20        [Concern(typeof (Compensation))]
21        public class when_calculating_the_amount_unvested : concern
22        {
23            Because b = () =>
24            {
25                //Calendar.stop(() => new DateTime(2009, 06, 07));
26                //sut.increase_salary_to(65500);
27                Calendar.freeze(() => new DateTime(2009, 09, 15));
28                sut.issue_grant(4500.00m, 10.00m, new One<Third>(), new Annually());
29
30                Calendar.thaw();
31                sut.grant_for(new DateTime(2009, 09, 15)).change_unit_price_to(20.00m);
32            };
33
34            [Ignore]
35            It should_indicate_that_nothing_has_vested_before_the_first_anniversary = () =>
36            {
37                sut.unvested_balance(new DateTime(2010, 09, 14)).should_be_equal_to(9000);
38            };
39
40            [Ignore]
41            It should_indicate_that_one_third_has_vested_after_the_first_anniversary = () =>
42            {
43                sut.unvested_balance(new DateTime(2010, 09, 15)).should_be_equal_to(6000);
44            };
45
46            It should_indicate_that_two_thirds_has_vested_after_the_second_anniversary = () =>
47            {
48                sut.unvested_balance(new DateTime(2011, 09, 15)).should_be_equal_to(3000);
49            };
50
51            It should_indicate_that_the_complete_grant_has_vested_after_the_third_anniversary = () =>
52            {
53                sut.unvested_balance(new DateTime(2012, 09, 15)).should_be_equal_to(0);
54            };
55        }
56    }
57}