public void TestAddHourlyEmployee() { int empId = 3; string name = "Tomasz"; double hourlyRate = 20.0; AddHourlyEmployee t = new AddHourlyEmployee(empId, name, "Home", hourlyRate); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual(name, e.Name); IPaymentClassification pc = e.Classification; Assert.IsTrue(pc is HourlyClassification); HourlyClassification hc = pc as HourlyClassification; Assert.AreEqual(hourlyRate, hc.HourlyRate, .001); IPaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is WeeklySchedule); IPaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TestAddCommissionedEmployee() { int empId = 2; string name = "Tadeusz"; double salary = 1000.0; double commissionedRate = 5.0; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, name, "Home", salary, commissionedRate); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual(name, e.Name); IPaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; Assert.AreEqual(salary, cc.Salary, .001); Assert.AreEqual(commissionedRate, cc.CommissionRate, .001); IPaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); IPaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TestAddSalariedEmployee() { int empId = 1; string name = "Bogdan"; double salary = 1000.0; AddSalariedEmployee t = new AddSalariedEmployee(empId, name, "Home", salary); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual(name, e.Name); IPaymentClassification pc = e.Classification; Assert.IsTrue(pc is SalariedClassification); SalariedClassification sc = pc as SalariedClassification; Assert.AreEqual(salary, sc.Salary, .001); IPaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is MonthlySchedule); IPaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void DeleteRow(IPaymentSchedule sc) { if (ParentModel.Order.OrderBaseType == OrderBaseTypes.Current) { (Schedules as List <PaymentSchedule>).Remove(sc as PaymentSchedule); } else { (Schedules as List <ReleasedPaymentSchedule>).Remove(sc as ReleasedPaymentSchedule); } }
public async Task ExecuteAsync() { Classification.PaymentClassification pc = MakeClassification(); IPaymentSchedule ps = MakeSchedule(); IPaymentMethod pm = new HoldMethod(); Employee e = new Employee(EmpId, Name, Address); e.Classification = pc; e.Schedule = ps; e.Method = pm; await PayrollDatabase.AddEmployeeAsync(EmpId, e); }
public void Execute() { IPaymentClassification pc = MakeClassification(); IPaymentSchedule ps = MakeSchedule(); IPaymentMethod pm = new HoldMethod(); IAffiliation af = new NoAffiliation(); Employee e = new Employee(_empId, _name, _address); e.Classification = pc; e.Schedule = ps; e.Method = pm; e.Affiliation = af; PayrollDatabase.AddEmlpoyee(e.EmpId, e); }
public async Task ChangeSalariedTransaction() { int empId = 7; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Lance", "Home", 2500, 3.2); await t.ExecuteAsync(); ChangeSalariedTransaction cht = new ChangeSalariedTransaction(empId, 2500); await cht.ExecuteAsync(); Employee e = await PayrollDatabase.GetEmployeeAsync(empId); Assert.NotNull(e); Classification.PaymentClassification pc = e.Classification; Assert.NotNull(pc); Assert.True(pc is Payroll.Classification.SalariedClassification); Payroll.Classification.SalariedClassification sc = pc as Payroll.Classification.SalariedClassification; Assert.Equal(2500, sc.Salary); IPaymentSchedule ps = e.Schedule; Assert.True(ps is BiWeeklySchedule); }
public async Task AddSalariedEmployee() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.0); await t.ExecuteAsync(); Employee e = await PayrollDatabase.GetEmployeeAsync(empId); Assert.Equal("Bob", e.Name); Classification.PaymentClassification pc = e.Classification; Assert.True(pc is Payroll.Classification.SalariedClassification); Payroll.Classification.SalariedClassification sc = pc as Payroll.Classification.SalariedClassification; Assert.Equal(1000.00, sc.Salary); IPaymentSchedule ps = e.Schedule; Assert.True(ps is MonthlySchedule); IPaymentMethod pm = e.Method; Assert.True(pm is HoldMethod); }
public async Task ChangeHourlyTransaction() { int empId = 6; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Lance", "Home", 2500, 3.2); await t.ExecuteAsync(); ChangeHourlyTransaction cht = new ChangeHourlyTransaction(empId, 27.52); await cht.ExecuteAsync(); Employee e = await PayrollDatabase.GetEmployeeAsync(empId); Assert.NotNull(e); Classification.PaymentClassification pc = e.Classification; Assert.NotNull(pc); Assert.True(pc is HourlyClassification); HourlyClassification hc = pc as HourlyClassification; Assert.Equal(27.52, hc.HourlyRate); IPaymentSchedule ps = e.Schedule; Assert.True(ps is WeeklySchedule); }
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); }