public void TestChangeCommissionedTransaction() { int empId = 3; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 3000m); t.Execute(); ChangeClassificationTransaction cht = new ChangeCommissionedTransaction(empId, 2500m, 3.4m); cht.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.That(e, Is.Not.Null); PaymentClassification pc = e.Classification; Assert.That(pc, Is.Not.Null); Assert.That(pc is CommissionedClassification, Is.True); CommissionedClassification cc = pc as CommissionedClassification; Assert.That(cc.Salary, Is.EqualTo(2500m)); Assert.That(cc.CommissionRate, Is.EqualTo(3.4m)); PaymentSchedule ps = e.Schedule; Assert.That(ps is BiWeeklySchedule); }
public void TestPaySingleSalariedEmployee() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00m); t.Execute(); DateTime payDate = new DateTime(2020, 11, 30); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); ValidatePaycheck(pt, empId, payDate, 1000m); }
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 TestSalariedUnionMemberDuesFridaysTest() { int empId = 1; var t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00m); t.Execute(); int memberId = 7734; var cmt = new ChangeMemberTransaction(empId, memberId, 9.42m); cmt.Execute(); DateTime payDate = new DateTime(2020, 01, 31); var pt = new PaydayTransaction(payDate); pt.Execute(); //5 Fridays in Jan var unionDues = 5m * 9.42m; ValidatePaycheck(pt, empId, payDate, 1000m, unionDues); }
public void TestAddSalariedEmployee() { int empId = 1; AddEmployeeTransaction t = new AddSalariedEmployee(empId, "Bob", "Home", 1000); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.That(e.Name, Is.EqualTo("Bob")); PaymentClassification pc = e.Classification; Assert.That(pc is SalariedClassification, Is.True); SalariedClassification sc = pc as SalariedClassification; Assert.That(sc.Salary, Is.EqualTo(1000)); PaymentSchedule ps = e.Schedule; Assert.That(ps is MonthlySchedule, Is.True); PaymentMethod pm = e.Method; Assert.That(pm is HoldMethod, Is.True); }