public void TestAddSalariedEmployee() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual("Bob", e.Name); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is SalariedClassification); SalariedClassification sc = pc as SalariedClassification; Assert.AreEqual(1000.00, sc.Salary, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is MonthlySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void PaySingleSalariedEmployeeOnWrongDate() { int empid = 1; AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bob", "Home", 1000.00); t.Execute(); DateTime payDate = new DateTime(2015, 11, 8); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); Paycheck pc = pt.GetPaycheck(empid); Assert.IsNull(pc); }
public void PaySingleSalariedEmployee() { int empid = 1; AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bill", "Home", 1000.00); t.Execute(); DateTime payDate = new DateTime(2001, 11, 30); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); Paycheck pc = pt.GetPaycheck(empid); Assert.IsNotNull(pc); Assert.AreEqual(payDate, pc.PayDate); Assert.AreEqual(1000.00, pc.GrossPay, .001); Assert.AreEqual("Hold", pc.GetField("Disposition")); Assert.AreEqual(0.0, pc.Deductions, .001); Assert.AreEqual(1000.00, pc.NetPay, .001); }
public void TestChangeMailMethodTransaction() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bill", "Home", 2000); t.Execute(); ChangeMailTransaction dt = new ChangeMailTransaction(empId); dt.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); PaymentMethod pm = e.Method; Assert.IsNotNull(pm); Assert.IsTrue(pm is MailMethod); }
public void TestChangeCommissionedTransaction() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bill", "Home", 2000); t.Execute(); ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empId, 1000, 25.5); cht.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; Assert.AreEqual(25.5, cc.CommissionRate, .001); Assert.AreEqual(1000, cc.Salary, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); }