main
 1using System;
 2using Machine.Specifications;
 3using presentation.windows.server.domain;
 4using presentation.windows.server.domain.payroll;
 5
 6namespace unit.server.domain.payroll
 7{
 8    public class CompensationSpecs
 9    {
10        public abstract class concern 
11        {
12            Establish c = () =>
13            {
14                sut = new Compensation();
15            };
16
17            static protected Compensation sut;
18        }
19
20        [Subject(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.stop(() => new DateTime(2009, 09, 15));
28                sut.issue_grant(4500.00, 10.00, new One<Third>(), new Annually());
29
30                Calendar.start();
31                sut.grant_for(new DateTime(2009, 09, 15)).change_unit_price_to(20.00);
32            };
33
34            It should_indicate_that_nothing_has_vested_before_the_first_anniversary = () =>
35            {
36                sut.unvested_balance(new DateTime(2010, 09, 14)).should_be_equal_to(9000);
37            };
38
39            It should_indicate_that_one_third_has_vested_after_the_first_anniversary = () =>
40            {
41                sut.unvested_balance(new DateTime(2010, 09, 15)).should_be_equal_to(6000);
42            };
43
44            It should_indicate_that_two_thirds_has_vested_after_the_second_anniversary = () =>
45            {
46                sut.unvested_balance(new DateTime(2011, 09, 15)).should_be_equal_to(3000);
47            };
48
49            It should_indicate_that_the_complete_grant_has_vested_after_the_third_anniversary = () =>
50            {
51                sut.unvested_balance(new DateTime(2012, 09, 15)).should_be_equal_to(0);
52            };
53        }
54    }
55}