public void TestAddCommissionedEmployee() { int empId = 3; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Justin", "Home", 2500, 9.5, database); t.Execute(); Employee e = database.GetEmployee(empId); Assert.AreEqual("Justin", e.Name); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionClassification); CommissionClassification cc = pc as CommissionClassification; Assert.AreEqual(2500, cc.BaseRate, .001); Assert.AreEqual(9.5, cc.CommissionRate, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiWeeklySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
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 TestAddHourlyEmployee() { int empId = 2; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Micah", "Home", 200.00, database); t.Execute(); Employee e = database.GetEmployee(empId); Assert.AreEqual("Micah", e.Name); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is HourlyClassification); HourlyClassification hc = pc as HourlyClassification; Assert.AreEqual(200.00, hc.HourlyRate, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is WeeklySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TestChangeHourlyTransaction() { int empId = 3; AddCommissionedEmployee t = new AddCommissionedEmployee( empId, "Lance", "Home", 2500, 3.2, database); t.Execute(); ChangeHourlyTransaction cht = new ChangeHourlyTransaction(empId, 27.52, database); cht.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is HourlyClassification); HourlyClassification hc = pc as HourlyClassification; Assert.AreEqual(27.52, hc.HourlyRate, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is WeeklySchedule); }
public void TestChangeSalaryTransaction() { int empId = 4; AddCommissionedEmployee t = new AddCommissionedEmployee( empId, "Lance", "Home", 2500, 3.2, database); t.Execute(); ChangeSalariedTransaction cst = new ChangeSalariedTransaction(empId, 3000.00, database); cst.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsNotNull(pc); Assert.IsTrue(pc is SalariedClassification); SalariedClassification sc = pc as SalariedClassification; Assert.AreEqual(3000.00, sc.Salary, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is MonthlySchedule); }
public void TestSalesReceiptTransaction() { int empId = 5; AddCommissionedEmployee t = new AddCommissionedEmployee( empId, "Bill", "Home", 2000, 15.25, database); t.Execute(); SalesReceiptTransaction tct = new SalesReceiptTransaction( new DateTime(2005, 7, 31), 250.00, empId, database); tct.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionClassification); CommissionClassification cc = pc as CommissionClassification; SalesReceipt sr = cc.GetSalesReceipt(new DateTime(2005, 7, 31)); Assert.IsNotNull(sr); Assert.AreEqual(250.00, sr.SaleAmount, .001); }
public void TestAddSalariedEmployee() { int empId = 1; AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00, database); t.Execute(); Employee e = database.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 MonthlySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
private void PrepareToSavePaymentClassification() { PaymentClassification classification = employee.Classification; if (classification is SalariedClassification) { classificationCode = "salaried"; SalariedClassification salariedClassification = classification as SalariedClassification; insertClassificationCommand = CreateInsertSalariedClassificationCommand( salariedClassification); } else if (classification is HourlyClassification) { classificationCode = "hourly"; } else if (classification is CommissionedClassification) { classificationCode = "commissioned"; } else { classificationCode = "unknown"; } }
public void TestTimeCardTransaction() { int empId = 5; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database); t.Execute(); TimeCardTransaction tct = new TimeCardTransaction( new DateTime(2005, 7, 31), 8.0, empId, database); tct.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is HourlyClassification); HourlyClassification hc = pc as HourlyClassification; TimeCard tc = hc.GetTimeCard(new DateTime(2005, 7, 31)); Assert.IsNotNull(tc); Assert.AreEqual(8.0, tc.Hours); }
public override void Execute() { PaymentClassification pc = MakeClassification(); PaymentSchedule ps = MakeSchedule(); PaymentMethod pm = new HoldMethod(); Employee e = new Employee(empid, name, address); e.Classification = pc; e.Schedule = ps; e.Method = pm; database.AddEmployee(e); }
private void CreateSalariedClassification(DataRow row) { double salary = double.Parse(row["Salary"].ToString()); classification = new SalariedClassification(salary); }
private void CreateHourly(DataRow row) { double rate = Convert.ToDouble(row["HourlyRate"]); classification = new HourlyClassification(rate); }
private void CreateCommissioned(DataRow row) { double baseRate = Convert.ToDouble(row["Salary"]); double commissionRate = Convert.ToDouble(row["Commission"]); classification = new CommissionClassification(baseRate, commissionRate); }
private void CreateSalaried(DataRow row) { double salary = Convert.ToDouble(row["Salary"]); classification = new SalariedClassification(salary); }