public void default_payment_for_deduction_is_the_amortized_amount() { var d = Deduction.Create(salary, 3, MonetaryValue.of("php", 1000)); var p = DeductionPayment.Create(d); Assert.Equal(d.AmortizedAmount.DecimalValue(), p.PaidAmount.DecimalValue()); }
public void deduction_amortization_adjusted_when_custom_payment_was_made() { var d = Deduction.Create(salary, 3, MonetaryValue.of("php", 1000)); var actual = d.AmortizedAmount.DecimalValue(); var p = DeductionPayment.Create(d, MonetaryValue.of("php", 700)); Assert.Equal(d.Balance.DecimalValue(), 300); Assert.Equal(d.Paid.DecimalValue(), 700); Assert.Equal(d.Total.subtractValueOf(d.Paid).DecimalValue(), d.Balance.DecimalValue()); Assert.Equal(d.AmortizedAmount.DecimalValue(), (1000 - 700) / (3 - 1)); Assert.NotEqual(d.AmortizedAmount.DecimalValue(), actual); }
public TestFixture() { ISalaryRepository salary_repository = new SalaryRepository(); IEmployeeRepository employees_repository = new EmployeeRepository(); using (var uow = new NHUnitOfWork()) { var e = Employee.Create(Person.Create("juan", "santos", "puruntong", "", Gender.MALE, Date.Now), Date.Now); var s = Salary.Create(e, MonetaryValue.of("php", 10000)); var d = Deduction.Create(s, 3, MonetaryValue.of("php", 5000)); var da = Deduction.CreateAmortized(s, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS); var db = Deduction.CreateAmortized(s, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS); var dc = Deduction.CreateAmortized(s, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS); var e2 = Employee.Create(Person.Create("juan", "cruz", "dela cruz", "", Gender.MALE, Date.Now), Date.Now); var s2 = Salary.Create(e2, MonetaryValue.of("php", 15000)); var d2 = Deduction.Create(s2, 3, MonetaryValue.of("php", 3000)); var d2a = Deduction.CreateAmortized(s2, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS); var d2b = Deduction.CreateAmortized(s2, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS); var d2c = Deduction.CreateAmortized(s2, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS); var e3 = Employee.Create(Person.Create("ann", "santos", "cruz", "", Gender.FEMALE, Date.Now), Date.Now); var s3 = Salary.Create(e3, MonetaryValue.of("php", 13000)); var d3 = Deduction.Create(s3, 2, MonetaryValue.of("php", 2000)); var d3a = Deduction.CreateAmortized(s3, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS); var d3b = Deduction.CreateAmortized(s3, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS); var d3c = Deduction.CreateAmortized(s3, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS); var e4 = Employee.Create(Person.Create("audrey", "yin", "yang", "", Gender.FEMALE, Date.Now), Date.Now); var s4 = Salary.Create(e4, MonetaryValue.of("php", 14000)); var d4 = Deduction.Create(s4, 2, MonetaryValue.of("php", 5000)); var d4a = Deduction.CreateAmortized(s4, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS); var d4b = Deduction.CreateAmortized(s4, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS); var d4c = Deduction.CreateAmortized(s4, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS); employees_repository.Save(e); employees_repository.Save(e2); employees_repository.Save(e3); employees_repository.Save(e4); salary_repository.Save(s); salary_repository.Save(s2); salary_repository.Save(s3); salary_repository.Save(s4); uow.Commit(); } }
public void can_get_active_deductions() { using (var uow = new NHUnitOfWork()) { var employee = Employee.Create(Person.Create("a", "a", "a", "", Gender.MALE, Date.Now), Date.Now); var salary = Salary.Create(employee, MonetaryValue.of("PHP", 15000)); Deduction.Create(salary, 3, MonetaryValue.of("php", 1000)); Deduction.Create(salary, 3, MonetaryValue.of("php", 2000)); Deduction.Create(salary, 3, MonetaryValue.of("php", 3000)); // Deduction.Create(salary, 3, MonetaryValue.of("php", 0)); EventBroker.getInstance().Command(new CommandAssociateSalaryToEmployee(salary, employee)); _employees.Save(employee); _salaries.Save(salary); uow.Commit(); } using (var uow = new NHUnitOfWork()) { var ees = _employees.FetchAllActive(); var ds = _salaries.FetchEmployeeActiveDeduction(ees[0]); Assert.Equal(3, ds.Count); } }
public void can_add_deduction() { var d = Deduction.Create(salary, 3, MonetaryValue.of("php", 1000)); Assert.Contains <Deduction>(d, salary.ActiveDeductions); }