public void TestAddSalariedEmployee() { int empid = 1; AddEmployeeTransaction t = new AddSalariedEmployee(empid, "Bob", "Home", 1000.00); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empid); Assert.AreEqual(e.Name, "Bob"); IPaymentClassification pc = e.Classification; Assert.IsTrue(pc is SalariedClassification); SalariedClassification sc=pc as SalariedClassification; Assert.AreEqual(1000.00,sc.Salary,.001); IPaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is MonthlySchedule); IPayemntMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TestSalariedUnionMemberDues() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00); t.Execute(); int memberId = 7734; ChangeMemberTransaction cmt=new ChangeMemberTransaction(empId,memberId,9.42); cmt.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.0,pc.GrossPay,0.001); Assert.AreEqual("Hold",pc.GetField("Disposition")); Assert.AreEqual(0,pc.Deductions,0.001); Assert.AreEqual(1000-0, pc.NetPay, 0.001); }
public void TestPaySingleSalariedEmployeeOnWrongDate() { int empId = 1; AddSalariedEmployee t=new AddSalariedEmployee(empId,"Bob","Home",1000.00); t.Execute(); DateTime payDate=new DateTime(2001,11,29); PaydayTransaction pt=new PaydayTransaction(payDate); pt.Execute(); Paycheck pc = pt.GetPaycheck(empId); Assert.IsNull(pc); }
public void TestPaySingleSalariedEmployee() { //测试不重复支付薪水 int empId = 1; AddSalariedEmployee t=new AddSalariedEmployee(empId,"Bob","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,0.001); Assert.AreEqual("Hold",pc.GetField("Disposition")); Assert.AreEqual(0.0,pc.Deductions,0.001); Assert.AreEqual(1000.00,pc.NetPay,0.001); }