public void TestHourlyUnionMemberServiceCharge() { int empId = 12; var t = new AddHourlyEmployee(empId, "Bill", "Home", 15.24m); t.Execute(); int memberId = 1337; var cmt = new ChangeMemberTransaction(empId, memberId, 9.42m); cmt.Execute(); DateTime payDate = new DateTime(2020, 03, 20); ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42m); sct.Execute(); TimeCardTransaction tct = new TimeCardTransaction(payDate, 8.0, empId); tct.Execute(); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); Paycheck pc = pt.GetPaycheck(empId); ValidatePaycheck(pt, empId, payDate, 8 * 15.24m, 9.42m + 19.42m); }
private void ValidatePaycheck(PaydayTransaction pt, int empId, DateTime payDate, decimal pay, decimal deductions = 0m) { Paycheck pc = pt.GetPaycheck(empId); Assert.That(pc, Is.Not.Null); Assert.That(pc.PayPeriodEndDate, Is.EqualTo(payDate)); Assert.That(pc.GrossPay, Is.EqualTo(pay)); Assert.That(pc.Deductions, Is.EqualTo(deductions)); Assert.That(pc.NetPay, Is.EqualTo(pay - deductions)); }
public void TestPaySingleSalariedEmployeeOnWrongDate() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00m); t.Execute(); DateTime payDate = new DateTime(2020, 11, 29); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); Paycheck pc = pt.GetPaycheck(empId); Assert.That(pc, Is.Null); }
public void TestPaySingleCommissionedEmployeeWrongDate() { int empId = 3; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Bob", "Home", 1000m, 5m); t.Execute(); DateTime payDate = new DateTime(2020, 02, 20); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); var pc = pt.GetPaycheck(empId); Assert.That(pc, Is.Null); }
public void TestPaySingleHourlyEmployeeOnWrongDate() { int empId = 2; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m); t.Execute(); DateTime payDate = new DateTime(2020, 2, 6); TimeCardTransaction tct = new TimeCardTransaction(payDate, 2.0, empId); tct.Execute(); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); Paycheck pc = pt.GetPaycheck(empId); Assert.That(pc, Is.Null); }