public void TestChangeHoldTransaction() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00); t.Execute(); ITransaction cht = new ChangeMailTransaction(empId, "address123"); cht.Execute(); cht = new ChangeHoldTransaction(empId); cht.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual("Bob", e.Name); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void ExecuteTest() { int empId = 28; string mailAddress = "MisStreet"; AddEmployeeTransaction addSalEmp = new AddSalariedEmployee(empId, "kara", "samubola", 3000, database); addSalEmp.Execute(); ChangeMethodTranscation changeMailTrans = new ChangeMailTransaction(empId, mailAddress, database); changeMailTrans.Execute(); Employee emp = database.GetEmployee(empId); Assert.IsNotNull(emp); Assert.IsTrue(emp.Method is MailMethod); MailMethod mailMethod = emp.Method as MailMethod; Assert.IsNotNull(mailMethod); Assert.AreEqual(mailMethod.Address, mailAddress); }
public void TestChangeMailTransaction() { int empId = 2; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25); t.Execute(); ChangeMailTransaction mt = new ChangeMailTransaction(empId, "email"); mt.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); PaymentMethod pm = e.Method; Assert.IsNotNull(pm); Assert.IsTrue(pm is MailMethod); MailMethod dm = pm as MailMethod; Assert.AreEqual("email", dm.Address); }
public void TestChangeHoldTransaction() { var empId = 1; var addTx = new AddSalariedEmployee(empId, "Lance", "Home", 2500); addTx.Execute(); var changeMailTx = new ChangeMailTransaction(empId, "Home"); changeMailTx.Execute(); var changeHoldTx = new ChangeHoldTransaction(empId); changeHoldTx.Execute(); var employee = Database.GetEmployee(empId); Assert.IsNotNull(employee, "employee not found in database"); var method = employee.GetMethod(); Assert.IsInstanceOfType(method, typeof(HoldMethod), "employee does not have correct payment method"); }
public void TestChangeMailTransaction() { int empId = 10; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Lance", "Home", 1000.00); t.Execute(); ChangeMailTransaction cmt = new ChangeMailTransaction(empId); cmt.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); PaymentMethod pm = e.Method; Assert.IsNotNull(pm); Assert.IsTrue(pm is MailMethod); }