示例#1
0
 public void TestDeleteEmployee()
 {
     int empid = 4;
     AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bill", "home", 2000);
     t.Execute();
     Employee e = PayrollDatabase.GetEmployee(empid);
     Assert.IsNotNull(e);
     DeleteEmployeeTransaction dt = new DeleteEmployeeTransaction(empid);
     dt.Execute();
     e = PayrollDatabase.GetEmployee(empid);
     Assert.IsNull(e);
 }
示例#2
0
 public void TestDirectDepositMethod()
 {
     int empId = 10;
     AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bill", "home", 1000);
     t.Execute();
     ChangeDirectTransaction cdt = new ChangeDirectTransaction(empId, "Bank A", "123456789");
     cdt.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is DirectDepositMethod);
     DirectDepositMethod ddm = pm as DirectDepositMethod;
     Assert.AreEqual("Bank A", ddm.Bank);
     Assert.AreEqual("123456789", ddm.Account);
 }
示例#3
0
 public void TestCommissionedClassification()
 {
     int empId = 9;
     AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bill", "home", 1000);
     t.Execute();
     ChangeCommissionedTransaction cct = new ChangeCommissionedTransaction(empId, 10, 100);
     cct.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(10, cc.CRate);
     Assert.AreEqual(100, cc.Salary);
     PaymentSchedule ps = e.Schedule;
     Assert.IsTrue(ps is BiweeklySchedule);
 }
示例#4
0
 public void TestChangeAddressTransaction()
 {
     int empId = 7;
     AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bill", "home", 2000);
     t.Execute();
     ChangeAddressTransaction cat = new ChangeAddressTransaction(empId, "Office");
     cat.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     Assert.AreEqual("Office", e.Address);
 }
示例#5
0
 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 MontlySchedule);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is HoldMethod);
 }
示例#6
0
 public void PaySingleSalariedEmployeeOnWrongDate()
 {
     int empid = 15;
     AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bob", "Home", 1000.00);
     t.Execute();
     DateTime payDate = new DateTime(2015, 12, 16);
     PaydayTransaction pt = new PaydayTransaction(payDate);
     pt.Execute();
     Paycheck pc = pt.GetPaycheck(empid);
     Assert.IsNull(pc);
 }
示例#7
0
 public void PaySingleSalariedEmployee()
 {
     int empid = 14;
     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, .001);
     Assert.AreEqual("Hold", pc.GetField("Disposition"));
     Assert.AreEqual(0.0, pc.Deductions, .001);
     Assert.AreEqual(1000.00, pc.NetPay, .001);
 }