Ejemplo n.º 1
0
        public void ExecuteTest_PaySingleSalariedEmployee()
        {
            int      empId    = 67;
            int      memberId = 77;
            DateTime payDay   = new DateTime(2014, 12, 31);

            database.DeleteEmployee(empId);
            database.RemoveUnionMember(memberId);

            AddEmployeeTransaction addSalEmp = new AddSalariedEmployee(empId, "lasa", "fala Street", 3000, database);

            addSalEmp.Execute();
            Employee emp = database.GetEmployee(empId);

            Assert.IsTrue(emp.Method is HoldMethod);

            PayDayTransaction pt = new PayDayTransaction(payDay, database);

            pt.Execute();
            PayCheck payCheck = pt.GetPayCheck(empId);

            Assert.IsNotNull(payCheck);
            Assert.AreEqual(payCheck.GrossPay, 3000, 0.01);
            Assert.AreEqual(payCheck.Deductions, 0, 0.01);
            Assert.AreEqual(payCheck.NetPay, 3000, 0.01);
            Assert.AreEqual(payCheck.PayDay, payDay);
            Assert.AreEqual(payCheck.GetField("Disposition"), "Hold");
        }
Ejemplo n.º 2
0
        private void ValidatePaycheck(PayDayTransaction pt, int empId, DateTime payDate_Expe, double grossPay_Expe, double deductions_Expe)
        {
            PayCheck pc = pt.GetPayCheck(empId);

            Assert.IsNotNull(pc);

            Assert.AreEqual(payDate_Expe, pc.PayDay);
            Assert.AreEqual(grossPay_Expe, pc.GrossPay, 0.001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(deductions_Expe, pc.Deductions, 0.001);
            Assert.AreEqual(grossPay_Expe - deductions_Expe, pc.NetPay, 0.001);
        }
Ejemplo n.º 3
0
        public void ExecuteTest_PaySingleCommissionedEmployeeOnWrongDate()
        {
            int empId = 2;
            AddCommissionedEmployee t = new AddCommissionedEmployee(
                empId, "Bill", "Home", 1500, 10, database);

            t.Execute();
            DateTime payDate = new DateTime(2018, 1, 12); // wrong friday

            SalesReceiptTransaction sr =
                new SalesReceiptTransaction(payDate, 5000.00, empId, database);

            sr.Execute();
            PayDayTransaction pt = new PayDayTransaction(payDate, database);

            pt.Execute();

            PayCheck pc = pt.GetPayCheck(empId);

            Assert.IsNull(pc);
        }
Ejemplo n.º 4
0
        public void ExecuteTest_PayHourlyEmployeeOnWrongDate()
        {
            int empId = 2;

            database.DeleteEmployee(empId);

            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();
            DateTime payDate = new DateTime(2001, 11, 7);   //Wednesday

            TimeCardTransaction tc = new TimeCardTransaction(payDate, 9.0, empId, database);

            tc.Execute();
            PayDayTransaction pt = new PayDayTransaction(payDate, database);

            pt.Execute();
            PayCheck pc = pt.GetPayCheck(empId);

            Assert.IsNull(pc);
        }
Ejemplo n.º 5
0
        public void ExecuteTest_PayHourlyEmployeeNoTimeCard()
        {
            int      empId    = 89;
            int      memberId = 907;
            DateTime payDay   = new DateTime(2001, 11, 9);

            database.DeleteEmployee(empId);
            database.RemoveUnionMember(memberId);

            AddEmployeeTransaction addHourlyEmp = new AddHourlyEmployee(empId, "lasa", "fala Street", 30, database);

            addHourlyEmp.Execute();
            Employee emp = database.GetEmployee(empId);

            Assert.IsTrue(emp.Method is HoldMethod);

            PayDayTransaction pt = new PayDayTransaction(payDay, database);

            pt.Execute();
            PayCheck payCheck = pt.GetPayCheck(empId);

            ValidatePaycheck(pt, empId, payDay, 0, 0);
        }