summaryrefslogtreecommitdiff
path: root/product/support
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2010-07-23 12:16:55 -0600
committermo khan <mo@mokhan.ca>2010-07-23 12:16:55 -0600
commita6a5b44ac73e07c5c05879646984813a49163b92 (patch)
tree8c31d887d13895813bd121b474e7bb95cf630511 /product/support
parent21626ea5f10b13b9e08bc1b823662cdaedd244b9 (diff)
added payroll domain model from spike project.main
Diffstat (limited to 'product/support')
-rw-r--r--product/support/unit/server/domain/accounting/SummaryAccountSpecs.cs1
-rw-r--r--product/support/unit/server/domain/payroll/CompensationSpecs.cs55
-rw-r--r--product/support/unit/server/domain/payroll/DateSpecs.cs25
-rw-r--r--product/support/unit/server/domain/payroll/GrantSpecs.cs60
-rw-r--r--product/support/unit/server/domain/payroll/MoneySpecs.cs24
-rw-r--r--product/support/unit/unit.csproj4
6 files changed, 168 insertions, 1 deletions
diff --git a/product/support/unit/server/domain/accounting/SummaryAccountSpecs.cs b/product/support/unit/server/domain/accounting/SummaryAccountSpecs.cs
index 871df21..d1cd834 100644
--- a/product/support/unit/server/domain/accounting/SummaryAccountSpecs.cs
+++ b/product/support/unit/server/domain/accounting/SummaryAccountSpecs.cs
@@ -1,4 +1,3 @@
-using System;
using Machine.Specifications;
using presentation.windows.server.domain.accounting;
diff --git a/product/support/unit/server/domain/payroll/CompensationSpecs.cs b/product/support/unit/server/domain/payroll/CompensationSpecs.cs
new file mode 100644
index 0000000..06fd001
--- /dev/null
+++ b/product/support/unit/server/domain/payroll/CompensationSpecs.cs
@@ -0,0 +1,55 @@
+using System;
+using Machine.Specifications;
+using presentation.windows.server.domain;
+using presentation.windows.server.domain.payroll;
+
+namespace unit.server.domain.payroll
+{
+ public class CompensationSpecs
+ {
+ public abstract class concern
+ {
+ Establish c = () =>
+ {
+ sut = new Compensation();
+ };
+
+ static protected Compensation sut;
+ }
+
+ [Subject(typeof (Compensation))]
+ public class when_calculating_the_amount_unvested : concern
+ {
+ Because b = () =>
+ {
+ //Calendar.stop(() => new DateTime(2009, 06, 07));
+ //sut.increase_salary_to(65500);
+ Calendar.stop(() => new DateTime(2009, 09, 15));
+ sut.issue_grant(4500.00, 10.00, new One<Third>(), new Annually());
+
+ Calendar.start();
+ sut.grant_for(new DateTime(2009, 09, 15)).change_unit_price_to(20.00);
+ };
+
+ It should_indicate_that_nothing_has_vested_before_the_first_anniversary = () =>
+ {
+ sut.unvested_balance(new DateTime(2010, 09, 14)).should_be_equal_to(9000);
+ };
+
+ It should_indicate_that_one_third_has_vested_after_the_first_anniversary = () =>
+ {
+ sut.unvested_balance(new DateTime(2010, 09, 15)).should_be_equal_to(6000);
+ };
+
+ It should_indicate_that_two_thirds_has_vested_after_the_second_anniversary = () =>
+ {
+ sut.unvested_balance(new DateTime(2011, 09, 15)).should_be_equal_to(3000);
+ };
+
+ It should_indicate_that_the_complete_grant_has_vested_after_the_third_anniversary = () =>
+ {
+ sut.unvested_balance(new DateTime(2012, 09, 15)).should_be_equal_to(0);
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/product/support/unit/server/domain/payroll/DateSpecs.cs b/product/support/unit/server/domain/payroll/DateSpecs.cs
new file mode 100644
index 0000000..71f5fc8
--- /dev/null
+++ b/product/support/unit/server/domain/payroll/DateSpecs.cs
@@ -0,0 +1,25 @@
+using System;
+using Gorilla.Commons.Utility;
+using Machine.Specifications;
+
+namespace unit.server.domain.payroll
+{
+ public class DateSpecs
+ {
+ [Subject(typeof (Date))]
+ public class when_two_dates_are_the_same
+ {
+ Establish c = () =>
+ {
+ sut = new DateTime(2009, 01, 01, 01, 00, 00);
+ };
+
+ It should_be_equal = () =>
+ {
+ sut.Equals(new DateTime(2009, 01, 01, 09, 00, 01)).should_be_true();
+ };
+
+ static Date sut;
+ }
+ }
+} \ No newline at end of file
diff --git a/product/support/unit/server/domain/payroll/GrantSpecs.cs b/product/support/unit/server/domain/payroll/GrantSpecs.cs
new file mode 100644
index 0000000..2ff8661
--- /dev/null
+++ b/product/support/unit/server/domain/payroll/GrantSpecs.cs
@@ -0,0 +1,60 @@
+using System;
+using Gorilla.Commons.Utility;
+using Machine.Specifications;
+using presentation.windows.server.domain;
+using presentation.windows.server.domain.payroll;
+
+namespace unit.server.domain.payroll
+{
+ public class GrantSpecs
+ {
+ public abstract class concern
+ {
+ Establish c = () =>
+ {
+ Calendar.stop(() => new DateTime(2010, 01, 01));
+ sut = Grant.New(120, 10, new One<Twelfth>(), new Monthly());
+ };
+
+ static protected Grant sut;
+ }
+
+ [Subject(typeof (Grant))]
+ public class when_checking_what_the_outstanding_balance_of_a_grant_is : concern
+ {
+ It should_return_the_full_balance_before_the_first_vesting_date = () =>
+ {
+ Calendar.stop(() => new DateTime(2010, 01, 31));
+ sut.balance().should_be_equal_to(120);
+ };
+
+ It should_return_the_unvested_portion_after_the_first_vesting_date = () =>
+ {
+ Calendar.stop(() => new DateTime(2010, 02, 01));
+ sut.balance().should_be_equal_to(110);
+ };
+ }
+
+ [Subject(typeof (Grant))]
+ public class when_checking_what_the_value_of_a_grant_was_in_the_past : concern
+ {
+ Because b = () =>
+ {
+ Calendar.stop(() => january_15);
+ sut.change_unit_price_to(20);
+
+ Calendar.reset();
+ sut.change_unit_price_to(40);
+ result = sut.balance(january_15);
+ };
+
+ It should_return_the_correct_amount = () =>
+ {
+ result.should_be_equal_to(240);
+ };
+
+ static Money result;
+ static Date january_15 = new DateTime(2010, 01, 15);
+ }
+ }
+} \ No newline at end of file
diff --git a/product/support/unit/server/domain/payroll/MoneySpecs.cs b/product/support/unit/server/domain/payroll/MoneySpecs.cs
new file mode 100644
index 0000000..33dfaa5
--- /dev/null
+++ b/product/support/unit/server/domain/payroll/MoneySpecs.cs
@@ -0,0 +1,24 @@
+using Machine.Specifications;
+using presentation.windows.server.domain.payroll;
+
+namespace unit.server.domain.payroll
+{
+ public class MoneySpecs
+ {
+ [Subject(typeof (Money))]
+ public class when_two_monies_are_the_same
+ {
+ Establish c = () =>
+ {
+ sut = 100.00;
+ };
+
+ It should_be_equal = () =>
+ {
+ sut.Equals(100.00);
+ };
+
+ static Money sut;
+ }
+ }
+} \ No newline at end of file
diff --git a/product/support/unit/unit.csproj b/product/support/unit/unit.csproj
index e7ab785..69c522d 100644
--- a/product/support/unit/unit.csproj
+++ b/product/support/unit/unit.csproj
@@ -59,6 +59,10 @@
<Compile Include="server\domain\accounting\QuantitySpecs.cs" />
<Compile Include="server\domain\accounting\SummaryAccountSpecs.cs" />
<Compile Include="server\domain\accounting\TransactionSpecs.cs" />
+ <Compile Include="server\domain\payroll\CompensationSpecs.cs" />
+ <Compile Include="server\domain\payroll\DateSpecs.cs" />
+ <Compile Include="server\domain\payroll\GrantSpecs.cs" />
+ <Compile Include="server\domain\payroll\MoneySpecs.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\client\client.ui\client.csproj">