public void TestChangeCommissionTransaction() { int empId = 5; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 15.25, database); t.Execute(); ChangeCommissionedTransaction cct = new ChangeCommissionedTransaction(empId, 2000.00, 3.8, database); cct.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; Assert.AreEqual(2000.00, cc.Salary, 0.001); Assert.AreEqual(3.8, cc.CommissionRate, 0.001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); }
public void TestChangeCommisionTransaction() { int empId = 5; AddSalariedEmployee t = new AddSalariedEmployee( empId, "Bob", "Home", 2500.00, database); t.Execute(); ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empId, 1250.00, 5.6, database); cht.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is CommissionClassification); CommissionClassification cc = pc as CommissionClassification; Assert.AreEqual(1250.00, cc.BaseRate, .001); Assert.AreEqual(5.6, cc.CommissionRate, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiWeeklySchedule); }
public void TestChangeCommissionedTransaction() { var empId = 1; var addTx = new AddSalariedEmployee(empId, "Lance", "Home", 2500); addTx.Execute(); var changeCommisionedTx = new ChangeCommissionedTransaction(empId, 2000M, 0.2M); changeCommisionedTx.Execute(); var employee = Database.GetEmployee(empId); Assert.IsNotNull(employee, "employee not found in database"); var classification = employee.GetClassification(); Assert.IsInstanceOfType(classification, typeof(CommissionedClassification), "employee does not have commissioned classification"); var salariedClassification = (CommissionedClassification)classification; Assert.AreEqual(2000M, salariedClassification.Salary); Assert.AreEqual(0.2M, salariedClassification.CommissionRate); var schedule = employee.GetSchedule(); Assert.IsInstanceOfType(schedule, typeof(BiweeklySchedule), "schedule is not biweekly"); }
public void TestChangeCommissionedTransaction() { int empId = 3; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Lance", "Home", 2500); t.Execute(); ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empId, 3000, 20); cht.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is ComissinedClassification); ComissinedClassification hc = pc as ComissinedClassification; Assert.AreEqual(3000, hc.Salary, .001); Assert.AreEqual(20, hc.ComissionRate, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); }
public void TestChangeCommissionedTransaction() { int empId = 2; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25); t.Execute(); ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empId, 2500, 3.2); cht.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification hc = pc as CommissionedClassification; Assert.AreEqual(2500, hc.Salary); Assert.AreEqual(3.2, hc.CommissionRate); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); }
public void ChangeSalariedEmployeeIntoCommissionedEmployeeTest() { AddSalariedEmployee se = new AddSalariedEmployee(base.EmpId, base.Name, base.Address, base.Salary); se.Execute(); ChangeCommissionedTransaction cct = new ChangeCommissionedTransaction(base.EmpId, base.Salary, base.CommissionRate); cct.Execute(); var e = PayrollDatabase.GetEmployee(base.EmpId); Assert.IsTrue(e.Classification is CommissionedClassification); Assert.IsTrue(e.Schedule is BiweeklySchedule); }
public void TestChangeCommissionedTransaction() { int employeeId = 13; AddEmployTransaction AddHourlyEmployee = new AddSalariedEmployee(employeeId, "Bill", "Home", 1000.0); AddHourlyEmployee.Execute(); Employee e = PayrollRepository.GetEmployee(employeeId); e.Classification.Should().BeOfType <SalariedClassification>(); ChangeCommissionedTransaction cct = new ChangeCommissionedTransaction(employeeId, 800.0, 19.25); cct.Execute(); e = PayrollRepository.GetEmployee(employeeId); e.Classification.Should().BeOfType <CommissionedClassification>(); CommissionedClassification cc = e.Classification as CommissionedClassification; cc.Salary.Should().Be(800.0); cc.CommissionedRate.Should().Be(19.25); e.Schedule.Should().BeOfType <BiweeklySchedule>(); }
public async Task ChangeCommissionedTransaction() { int empId = 8; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Lance", "Home", 2500); await t.ExecuteAsync(); ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empId, 2600, 4.4); await cht.ExecuteAsync(); Employee e = await PayrollDatabase.GetEmployeeAsync(empId); Assert.NotNull(e); Classification.PaymentClassification pc = e.Classification; Assert.NotNull(pc); Assert.True(pc is CommissionedClassification); CommissionedClassification sc = pc as CommissionedClassification; Assert.Equal(2600, sc.BaseRate); Assert.Equal(4.4, sc.CommissionedRate); IPaymentSchedule ps = e.Schedule; Assert.True(ps is MonthlySchedule); }
public void ChangeCommissionedTransaction() { int empId = SetupSalariedEmployee(); var cct = new ChangeCommissionedTransaction(empId, 2200.0, 3.2); cct.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.NotNull(e); PaymentClassification pc = e.Classification; Assert.NotNull(pc); var cc = Assert.IsType <CommissionedClassification>(pc); Assert.Equal(2200.0, cc.Salary); Assert.Equal(3.2, cc.CommissionRate); PaymentSchedule ps = e.Schedule; Assert.IsType <BiweeklySchedule>(ps); }
public void ChangeCommissionedTransaction() { int empid = 13; AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bill", "Home", 23.41); t.Execute(); ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empid, 20.44, 10); cht.Execute(); Employee e = PayrollDatabase.GetEmployee_Static(empid); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification sc = pc as CommissionedClassification; Assert.AreEqual(10, sc.Commission); Assert.AreEqual(20.44, sc.Salary); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); }
public void TestChangeCommissionedTransaction() { const int empId = 12; var t = new AddHourlyEmployee(empId, "Lance", "Home", 27.52); t.Execute(); var cct = new ChangeCommissionedTransaction(empId, 2500.00, 3.2); cct.Execute(); var e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); var pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is CommissionedClassification); var cc = pc as CommissionedClassification; Assert.AreEqual(2500.00, cc.Salary, 0.001); Assert.AreEqual(3.2, cc.CommissionRate, 0.001); var ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); }
public void ExecuteTest() { int empId = 28; double baseRate = 2.3; double commissionRate = 5.6; AddEmployeeTransaction addSalEmp = new AddSalariedEmployee(empId, "kara", "samubola", 3000, database); addSalEmp.Execute(); ChangeClassificationTranscation changeCommissionedTrans = new ChangeCommissionedTransaction(empId, baseRate, commissionRate, database); changeCommissionedTrans.Execute(); Employee emp = database.GetEmployee(empId); Assert.IsNotNull(emp); Assert.IsTrue(emp.Classification is CommissionClassification); CommissionClassification hc = emp.Classification as CommissionClassification; Assert.IsNotNull(hc); Assert.AreEqual(hc.BaseRate, baseRate); Assert.AreEqual(hc.CommissionRate, commissionRate); }