Commit a8a24d6
Changed files (8)
product
service
domain
specs
unit
service
domain
payroll
product/service/domain/accounting/DetailAccount.cs
@@ -38,7 +38,7 @@ namespace solidware.financials.service.domain.accounting
public Quantity balance()
{
- return balance(Calendar.now());
+ return balance(Calendar.today());
}
public Quantity balance(Date date)
product/service/domain/accounting/Entry.cs
@@ -11,7 +11,7 @@ namespace solidware.financials.service.domain.accounting
{
return new Entry
{
- when_booked = Calendar.now(),
+ when_booked = Calendar.today(),
transaction_type = new Transaction(),
amount = amount,
};
product/service/domain/accounting/SummaryAccount.cs
@@ -20,7 +20,7 @@ namespace solidware.financials.service.domain.accounting
public Quantity balance()
{
- return balance(Calendar.now());
+ return balance(Calendar.today());
}
public Quantity balance(Date date)
product/service/domain/payroll/Grant.cs
@@ -13,7 +13,7 @@ namespace solidware.financials.service.domain.payroll
{
var grant = new Grant
{
- issued_on = Calendar.now(),
+ issued_on = Calendar.today(),
};
grant.change_unit_price_to(price);
grant.purchase(purchase_amount);
@@ -35,7 +35,7 @@ namespace solidware.financials.service.domain.payroll
public virtual Money balance()
{
- return balance(Calendar.now());
+ return balance(Calendar.today());
}
public virtual Money balance(Date on_date)
@@ -60,7 +60,7 @@ namespace solidware.financials.service.domain.payroll
UnitPrice current_unit_price()
{
- return unit_price(Calendar.now());
+ return unit_price(Calendar.today());
}
UnitPrice unit_price(Date on_date)
product/service/domain/payroll/History.cs
@@ -22,7 +22,7 @@ namespace solidware.financials.service.domain.payroll
{
public Event(K adjustment)
{
- date_of_change = Calendar.now();
+ date_of_change = Calendar.today();
this.adjustment = adjustment;
}
product/service/domain/Calendar.cs
@@ -7,24 +7,19 @@ namespace solidware.financials.service.domain
static Func<Date> date = () => DateTime.Now.Date;
static Func<Date> default_date = () => DateTime.Now.Date;
- static public void stop(Func<Date> new_date)
+ static public void freeze(Func<Date> new_date)
{
date = new_date;
}
- static public void start()
+ static public void thaw()
{
date = default_date;
}
- static public Date now()
+ static public Date today()
{
return date();
}
-
- static public void reset()
- {
- date = default_date;
- }
}
}
\ No newline at end of file
product/specs/unit/service/domain/payroll/CompensationSpecs.cs
@@ -24,10 +24,10 @@ namespace specs.unit.service.domain.payroll
{
//Calendar.stop(() => new DateTime(2009, 06, 07));
//sut.increase_salary_to(65500);
- Calendar.stop(() => new DateTime(2009, 09, 15));
+ Calendar.freeze(() => new DateTime(2009, 09, 15));
sut.issue_grant(4500.00m, 10.00m, new One<Third>(), new Annually());
- Calendar.start();
+ Calendar.thaw();
sut.grant_for(new DateTime(2009, 09, 15)).change_unit_price_to(20.00m);
};
product/specs/unit/service/domain/payroll/GrantSpecs.cs
@@ -11,13 +11,13 @@ namespace specs.unit.service.domain.payroll
{
Establish context = () =>
{
- Calendar.stop(() => new DateTime(2010, 01, 01));
+ Calendar.freeze(() => new DateTime(2010, 01, 01));
sut = Grant.New(120, 10, new One<Twelfth>(), new Monthly());
};
Cleanup clean = () =>
{
- Calendar.reset();
+ Calendar.thaw();
};
static protected Grant sut;
@@ -28,13 +28,13 @@ namespace specs.unit.service.domain.payroll
{
It should_return_the_full_balance_before_the_first_vesting_date = () =>
{
- Calendar.stop(() => new DateTime(2010, 01, 31));
+ Calendar.freeze(() => 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));
+ Calendar.freeze(() => new DateTime(2010, 02, 01));
sut.balance().should_be_equal_to(110);
};
}
@@ -44,10 +44,10 @@ namespace specs.unit.service.domain.payroll
{
Because b = () =>
{
- Calendar.stop(() => january_15);
+ Calendar.freeze(() => january_15);
sut.change_unit_price_to(20);
- Calendar.reset();
+ Calendar.thaw();
sut.change_unit_price_to(40);
result = sut.balance(january_15);
};