public void TestCommissionedEmployee() { int empId = 1; AddCommissionEmployee t = new AddCommissionEmployee(empId, "Kubing", "Home", 500.00, 80.00, database); t.Execute(); Employee e = database.GetEmployee(empId); Assert.That("Kubing", Is.EqualTo(e.Name)); PaymentClassification pc = e.Classification; Assert.That(pc is CommissionedClassification, Is.True); CommissionedClassification sc = pc as CommissionedClassification; Assert.AreEqual(500.00, sc.Salary, .001); Assert.AreEqual(80.00, sc.CommissionRate, .001); PaymentSchedule ps = e.Schedule; Assert.That(ps is BiweeklySchedule, Is.True); PaymentMethod pm = e.Method; Assert.That(pm is HoldMethod, Is.True); }
public void TestAddCommissionedEmployee() { #region Arrange int empId = 3; string userName = "******"; string address = "Xindian"; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, userName, address, 500.0, 97.5); #endregion #region Action t.Execute(); #endregion #region Assert Employee e = PayrollRepository.GetEmployee(empId); e.Name.Should().Be(userName); e.Address.Should().Be(address); PaymentClassification pc = e.Classification; pc.Should().BeOfType <CommissionedClassification>(); CommissionedClassification cc = pc as CommissionedClassification; cc.Salary.Should().Be(500.0); cc.CommissionedRate.Should().Be(97.5); PaymentSchedule ps = e.Schedule; ps.Should().BeOfType <BiweeklySchedule>(); PaymentMethod pm = e.Method; pm.Should().BeOfType <HoldMethod>(); #endregion }
public void TestAddCommissionedEmployee() { int empId = 3; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Jane", "Field", 1000.00, 0.15); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual("Jane", e.Name); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; Assert.AreEqual(1000.00, cc.Salary, .001); Assert.AreEqual(0.15, cc.CommissionRate, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TestAddSalesReceiptTransaction() { #region Arrange int employeeId = 5; AddCommissionedEmployee t = new AddCommissionedEmployee(employeeId, "user", "home", 1000, 97.5); t.Execute(); DateTime workingDate = new DateTime(2019, 4, 21); SalesReceiptTransaction srt = new SalesReceiptTransaction( employeeId, workingDate, 200 ); #endregion #region Action srt.Execute(); #endregion #region Assert Employee e = PayrollRepository.GetEmployee(employeeId); e.Should().NotBeNull(); e.Classification.Should().BeOfType <CommissionedClassification>(); CommissionedClassification cc = e.Classification as CommissionedClassification; SalesReceipt sr = cc.GetSalesReceipt(workingDate); sr.Should().NotBeNull(); sr.Amount.Should().Be(200); #endregion }
public void LoadCommissionedClassificationOneSalesReceipt() { employee.Schedule = new BiweeklySchedule(); employee.Method = new DirectDepositMethod("1st Bank", "0123456"); employee.Classification = new CommissionedClassification(500.00, 80.30); database.AddEmployee(employee); var saleDay = new DateTime(2001, 11, 16); SalesReceiptTransaction srt = new SalesReceiptTransaction(saleDay, 3, 123, database); srt.Execute(); Employee loadedEmployee = database.GetEmployee(123); PaymentClassification classification = loadedEmployee.Classification; Assert.IsTrue(classification is CommissionedClassification); CommissionedClassification commissionedClassification = classification as CommissionedClassification; Assert.AreEqual(500.00, commissionedClassification.Salary, .01); Assert.AreEqual(80.30, commissionedClassification.CommissionRate, .01); var salesReceipts = commissionedClassification.SalesReceipts; Assert.AreEqual(1, salesReceipts.Count); var sr = salesReceipts[saleDay] as SalesReceipt; Assert.IsNotNull(sr); Assert.AreEqual(3, sr.Amount); }
public void TestSalesReceiptTransaction() { int empId = 6; DateTime saleDate = new DateTime(2017, 09, 07); AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Commissioned", "Sertãozinho", 1000, 10, database); t.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); SalesReceiptTransaction srt = new SalesReceiptTransaction(empId, saleDate, 100.00, database); srt.Execute(); CommissionedClassification cc = pc as CommissionedClassification; SalesReceipt sr = cc.GetSalesReceipt(saleDate); Assert.IsNotNull(sr); Assert.AreEqual(100.00, sr.SaleAmount, .001); }
public void SalesReceiptTransaction() { int empId = 5; AddCommissionedEmployee t = new AddCommissionedEmployee( empId, "Bob", "Home", 1000.00, 10, database); t.Execute(); SalesReceiptTransaction srt = new SalesReceiptTransaction( new DateTime(2005, 7, 31), 100.0, empId, database); srt.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; SalesReceipt sr = cc.GetSalesReceipt(new DateTime(2005, 7, 31)); Assert.IsNotNull(sr); Assert.AreEqual(100, sr.Amount); }
public void TestSalesReceiptTransaction() { int empId = 6; AddCommissionEmployee t = new AddCommissionEmployee(empId, "Kubing", "Home", 2000, 3.0, database); t.Execute(); var saleDay = new DateTime(2017, 3, 19); SalesReceiptTransaction srt = new SalesReceiptTransaction(saleDay, 4, empId, database); srt.Execute(); Employee e = database.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification hc = pc as CommissionedClassification; var salesReceipts = database.GetSalesReceipts(empId).ToList(); var sr = salesReceipts.FirstOrDefault(x => x.Date == saleDay); Assert.IsNotNull(sr); Assert.AreEqual(4, sr.Amount); }
public void TestAddCommissionedEmployee() { int empId = 3; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Comissionado", "Endereço", 500.00, 10.00, database); t.Execute(); Employee e = database.GetEmployee(empId); Assert.AreEqual("Comissionado", e.Name); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; Assert.AreEqual(500.0, cc.BaseRate, .001); Assert.AreEqual(10.0, cc.CommissionRate, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TestAddCommissionEmployee() { int empId = 1; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Bob", "Home", 1000.00, 500.00); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual("Bob", e.Name); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification sc = pc as CommissionedClassification; Assert.AreEqual(1000, sc.Salary); Assert.AreEqual(500, sc.CommissionRate); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TestAddCommisionedEmployee() { int empId = 1; var t = new AddCommissionedEmployee(empId, "Bob", "Home", 1000.0M, 50.0M); t.Execute(); var e = Database.GetEmployee(empId); Assert.AreEqual("Bob", e.Name); PaymentClassification pc = e.GetClassification(); CommissionedClassification sc = (CommissionedClassification)pc; Assert.AreEqual(sc.Salary, 1000.00M); Assert.AreEqual(sc.CommissionRate, 50.0M); PaymentSchedule ps = e.GetSchedule(); Assert.IsInstanceOfType(ps, typeof(BiweeklySchedule)); PaymentMethod pm = e.GetMethod(); Assert.IsInstanceOfType(pm, typeof(HoldMethod)); }
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 TestSalesReceiptTransaction() { int empId = 4; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Bill", "Home", 2500, 3.2); t.Execute(); SalesReceiptTransaction srt = new SalesReceiptTransaction(new DateTime(2005, 7, 31), 20, empId); srt.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification hc = pc as CommissionedClassification; SalesReceipt sr = hc.GetSalesReceipt(new DateTime(2005, 7, 31)); Assert.IsNotNull(sr); Assert.AreEqual(20, sr.Amount); }
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 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 Execute() { Employee e = PayrollDatabase.GetEmployee(_empId); if (e == null) { throw new InvalidOperationException("Nie ma takiego pracownika."); } CommissionedClassification cc = e.Classification as CommissionedClassification; if (cc == null) { throw new InvalidOperationException("Próba dodania karty czasu pracy do pracownika zatrudnionego" + " w systemie innym niż godzinowy."); } cc.AddSalesReport(new SalesReport(_date, _sale)); }
public void SalesReceiptTransaction() { int empid = 7; AddCommissionedEmployee s = new AddCommissionedEmployee(empid, "Bill", "Home", 38, 25000); s.Execute(); SalesReceiptTransaction crt = new SalesReceiptTransaction(new DateTime(2015, 10, 31), 15.15, empid); crt.Execute(); Employee e = PayrollDatabase.GetEmployee_Static(empid); Assert.IsNotNull(e); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; SalesReceipt sr = cc.GetSalary(new DateTime(2015, 10, 31)); Assert.IsNotNull(sr); Assert.AreEqual(15.15, sr.Amount); }
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 void TestSalesReceiptTransaction() { int empId = 5; app.ExexcuteTransaction("addCommissionedEmployee", RequestFactory.rf.MakeCommissionedEmployeeRequest(empId, "Bill", "Home", 2.5, 1000)); app.ExexcuteTransaction("addSalesReceipt", RequestFactory.rf.MakeSalesReceiptRequest(new DateTime(2005, 7, 31), 200, empId)); Employee e = PayrollDb.GetEmployee(empId); Assert.IsNotNull(e, "Employee is null"); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification cc = pc as CommissionedClassification; SalesReceipt sr = cc.GetSalesReceipt(new DateTime(2005, 7, 31)); Assert.IsNotNull(sr, "Sales receipt is null"); Assert.AreEqual(200, sr.Amount); }
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 TestAddCommissionedEmployee() { int empId = 1; AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Йорик", "Гочина 23", 2000.00, 2000.00); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.AreEqual("Йорик", e.name); PaymentClassification pc = e.classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification sc = pc as CommissionedClassification; Assert.AreEqual(2000.00, sc.Salary, .001); Assert.AreEqual(2000.00, sc.CommissionRate, .001); PaymentSchedule ps = e.schedule; Assert.IsTrue(ps is BiweeklySchedule); PaymentMethod pm = e.method; Assert.IsTrue(pm is HoldMethod); }
public void AddCommissionedEmployee() { int empid = 4; AddCommissionedEmployee t = new AddCommissionedEmployee(empid, "Bob", "Home", 265, 10); t.Execute(); Employee e = PayrollDatabase.GetEmployee_Static(empid); Assert.AreEqual("Bob", e.Name); PaymentClassification pc = e.Classification; Assert.IsTrue(pc is CommissionedClassification); CommissionedClassification sc = pc as CommissionedClassification; Assert.AreEqual(10, sc.Commission, .001); Assert.AreEqual(265, sc.Salary, .001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is BiweeklySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void Execute() { Employee e = PayrollRepository.GetEmployee(_employeeId); bool isValidEmployee = e != null; if (isValidEmployee) { CommissionedClassification cc = e.Classification as CommissionedClassification; bool isCommenssionedEmployee = cc != null; if (isCommenssionedEmployee) { cc.AddSalesReceipt(_employeeId, _workingDate, _amount); } else { throw new InvalidOperationException("non-commenssioned employee"); } } else { throw new InvalidOperationException("No such employee."); } }
public void AddCommissionEmployee() { int emplid = 3; string address = "3rd street"; string fullName = "John"; decimal salary = 100.0m; decimal commissionRate = .15m; AddEmployeeTransaction t = new AddCommissionedEmployee(emplid, address, fullName, salary, commissionRate); t.Execute(); Employee e = Database.GetEmployee(emplid); Assert.AreEqual(emplid, e.Emplid); Assert.AreEqual(address, e.Address); Assert.AreEqual(fullName, e.FullName); CheckEmployeePaymentTypes(typeof(CommissionedClassification), typeof(HoldMethod), typeof(BiweeklySchedule), e); CommissionedClassification cc = e.paymentClassification as CommissionedClassification; Assert.AreEqual(salary, cc.Salary); Assert.AreEqual(commissionRate, cc.CommissionRate); }
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); }