Exemplo n.º 1
0
 public void TimeCardTransaction()
 {
     int empId = 5;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2015, 10, 31), 8.0, empId);
     tct.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     PaymentClassification pc = e.Classification;
     Assert.IsTrue(pc is HourlyClassification);
     TimeCard tc = hc.GetTimeCard(new DateTime(2015, 10, 31));
     Assert.IsNotNull(tc);
     Assert.AreEqual(8.0, tc.Hours);
 }
Exemplo n.º 2
0
 public void TestAddHourlyEmployee()
 {
     int empId = 1;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bob", "Home", 24);
     t.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.AreEqual("Bob", e.Name);
     PaymentClassification pc = e.Classification;
     Assert.IsTrue(pc is HourlyClassification);
     HourlyClassification sc = pc as HourlyClassification;
     Assert.AreEqual(24, sc.HourlyRate, .001);
     PaymentSchedule ps = e.Schedule;
     Assert.IsTrue(ps is WeeklySchedule);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is HoldMethod);
 }
Exemplo n.º 3
0
        public void PayingSingleHourlyEmployeeTwoTimeCards()
        {
            int empid           = 23;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "HOme", 15.25);

            t.Execute();
            DateTime            payDate = new DateTime(2015, 12, 4);
            TimeCardTransaction tc      = new TimeCardTransaction(payDate, 2.0, empid);

            tc.Execute();
            TimeCardTransaction tc2 = new TimeCardTransaction(payDate.AddDays(-1), 5.0, empid);

            tc2.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidateHourlyPaycheck(pt, empid, payDate, 7 * 15.25);
        }
Exemplo n.º 4
0
        public void PaySingleHourlyEmployeeOvertimeOneTimeCard()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(
                empId, "Bill", "Home", 15.25, database);

            t.Execute();
            DateTime payDate = new DateTime(2001, 11, 9); // Friday

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

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

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, (8 + 1.5) * 15.25);
        }
Exemplo n.º 5
0
        public void PaySingleHourlyEmployeeOneTimeCard()
        {
            int empId           = 2;
            AddHourlyEmployee t =
                new AddHourlyEmployee(empId, "Билл", "Домашний", 15.25);

            t.Execute();

            DateTime            payDate = new DateTime(2001, 11, 9); // пятница
            TimeCardTransaction tc      =
                new TimeCardTransaction(payDate, 2.0, empId);

            tc.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidateHourlyPaycheck(pt, empId, payDate, 30.5);
        }
Exemplo n.º 6
0
        public void TestPaySingleHourlyEmployeeOneTimeCard()
        {
            int empId = 2;
            var addTx = new AddHourlyEmployee(empId, "Bill", "Home", 15.25M);

            addTx.Execute();
            var payDate = new Date(11, 9, 2001);

            Assert.AreEqual(DayOfWeek.Friday, payDate.DayOfWeek);
            var timecardTx = new TimeCardTransaction(payDate, 2.0M, empId);

            timecardTx.Execute();

            var paydayTx = new PaydayTransaction(payDate);

            paydayTx.Execute();
            ValidateHourlyPaycheck(paydayTx, empId, payDate, 30.5M);
        }
Exemplo n.º 7
0
        public void TestServiceChargesSpanningMultiplePayPeriods()
        {
            int empId           = 1;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 15.24, database);

            t.Execute();

            int memberId = 7734;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, 9.42, database);

            cmt.Execute();

            DateTime payDate             = new DateTime(2001, 11, 9);
            DateTime earlyDate           = new DateTime(2001, 11, 2);  //previous Friday
            DateTime lateDate            = new DateTime(2001, 11, 16); //next Friday
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42, database);

            sct.Execute();

            ServiceChargeTransaction sctEarly = new ServiceChargeTransaction(memberId, earlyDate, 100.00, database);

            sctEarly.Execute();

            ServiceChargeTransaction sctLate = new ServiceChargeTransaction(memberId, lateDate, 200.00, database);

            sctLate.Execute();

            TimeCardTransaction tct = new TimeCardTransaction(payDate, 8.0, empId, database);

            tct.Execute();

            PaydayTransaction pt = new PaydayTransaction(payDate, database);

            pt.Execute();

            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEnd);
            Assert.AreEqual(8 * 15.24, pc.GrossPay, 0.001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(9.42 + 19.42, pc.Deductions, 0.001);
            Assert.AreEqual((8 * 15.24) - (9.42 + 19.42), pc.NetPay, 0.001);
        }
Exemplo n.º 8
0
        public void PayingSingleHourlyEmployeeNoTimeCards()
        {
            int empid           = 19;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Home", 15.25);

            t.Execute();
            DateTime          payDate = new DateTime(2015, 11, 27);
            PaydayTransaction pt      = new PaydayTransaction(payDate);

            pt.Execute();
            Paycheck pc = pt.GetPaycheck(empid);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(0.0, pc.GrossPay);
            Assert.AreEqual("HOLD", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, .001);
            Assert.AreEqual(0.0, pc.NetPay, .001);
        }
Exemplo n.º 9
0
        public void TestChangeHoldransaction()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();

            ChangeHoldransaction mt = new ChangeHoldransaction(empId);

            mt.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentMethod pm = e.Method;

            Assert.IsNotNull(pm);
            Assert.IsTrue(pm is HoldMethod);
        }
Exemplo n.º 10
0
        public void PaySingleHourlyEmployeeOvertimeOneTimeCard()
        {
            int               empId      = 3;
            string            name       = "Marek";
            string            address    = "Home";
            double            hourlyRate = 15.25;
            int               hours      = 9;
            AddHourlyEmployee t          = new AddHourlyEmployee(empId, name, address, hourlyRate);

            t.Execute();
            DateTime            payDate = new DateTime(2001, 11, 9); // piątek
            TimeCardTransaction tc      = new TimeCardTransaction(payDate, hours, empId);

            tc.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidatePayCheck(pt, empId, payDate, (8 + 1.5) * hourlyRate);
        }
Exemplo n.º 11
0
        public void TestPaySingleHourlyEmployeeOneTimeCard()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 15.25, database);

            t.Execute();

            DateTime payDate = new DateTime(2001, 11, 9); //Friday

            TimeCardTransaction tct = new TimeCardTransaction(payDate, 2.0, empId, database);

            tct.Execute();

            PaydayTransaction pt = new PaydayTransaction(payDate, database);

            pt.Execute();

            ValidateHourlyPaycheck(pt, empId, payDate, 30.5);
        }
Exemplo n.º 12
0
        public void ExecuteTest_PayHourlyEmployeeOneTimeCard()
        {
            int empId = 2;

            database.DeleteEmployee(empId);

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

            t.Execute();
            DateTime payDate = new DateTime(2001, 11, 9);   //Friday

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

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

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, 30.5, 0);
        }
Exemplo n.º 13
0
        public void PaySingleHourlyEmployeeOnWrongDate()
        {
            int empId           = 2;
            AddHourlyEmployee t =
                new AddHourlyEmployee(empId, "Билл", "Домашний", 15.25);

            t.Execute();

            DateTime            payDate = new DateTime(2001, 11, 8); // четверг
            TimeCardTransaction tc      =
                new TimeCardTransaction(payDate, 9.0, empId);

            tc.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate);

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

            Assert.IsNull(pc);
        }
Exemplo n.º 14
0
        public void TestPaySingleHourlyEmployeeTwoTimeCards()
        {
            const int empId = 23;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();
            // Friday
            var payDate = new DateTime(2020, 11, 6);

            var tc = new TimeCardTransaction(payDate, 2.0, empId);

            tc.Execute();
            var tc2 = new TimeCardTransaction(payDate.AddDays(-1), 5.0, empId);

            tc2.Execute();
            var pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidateHourlyPaycheck(pt, empId, payDate, 7 * 15.25);
        }
Exemplo n.º 15
0
        public void TestChangeSalariedTransaction()
        {
            int employeeId           = 14;
            AddEmployTransaction ahe = new AddHourlyEmployee(employeeId, "Bill", "Home", 95.0);

            ahe.Execute();
            Employee e = PayrollRepository.GetEmployee(employeeId);

            e.Classification.Should().BeOfType <HourlyClassification>();
            ChangeSalariedTransation cst = new ChangeSalariedTransation(employeeId, 1000.0);

            cst.Execute();

            e = PayrollRepository.GetEmployee(employeeId);
            e.Classification.Should().BeOfType <SalariedClassification>();
            SalariedClassification sc = e.Classification as SalariedClassification;

            sc.Salary.Should().Be(1000.0);
            e.Schedule.Should().BeOfType <MonthlySchedule>();
        }
Exemplo n.º 16
0
        public void TestPaySingleHourlyEmployeeOnWrongDate()
        {
            const int empId = 22;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();
            // Thursday
            var payDate = new DateTime(2020, 11, 5);

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

            tc.Execute();
            var pt = new PaydayTransaction(payDate);

            pt.Execute();

            var pc = pt.GetPaycheck(empId);

            Assert.IsNull(pc);
        }
        public void PaySingleHourlyEmployeeOnWrongDate()
        {
            int empId           = 2222;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();

            DateTime            payDate = new DateTime(2001, 11, 8); // Thursday
            TimeCardTransaction tc      = new TimeCardTransaction(payDate, 9.0, empId);

            tc.Execute();

            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();

            Paycheck pc = pt.GetPaycheck(empId, payDate);

            Assert.IsNull(pc);
        }
Exemplo n.º 18
0
        public void TestServiceChargesSpanningMultiplePayPeriods()
        {
            const int empId = 27;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.24);

            t.Execute();

            const int memberId = 7736;
            var       cmt      = new ChangeMemberTransaction(empId, memberId, 9.42);

            cmt.Execute();

            var payDate   = new DateTime(2020, 11, 6);
            var earlyDate = new DateTime(2020, 10, 30);
            var lateDate  = new DateTime(2020, 11, 13);

            var sct = new ServiceChargeTransaction(memberId, payDate, 19.42);

            sct.Execute();
            var sctEarly = new ServiceChargeTransaction(memberId, earlyDate, 100.00);

            sctEarly.Execute();
            var sctLate = new ServiceChargeTransaction(memberId, lateDate, 200.00);

            sctLate.Execute();
            var tct = new TimeCardTransaction(payDate, 8.0, empId);

            tct.Execute();
            var pt = new PaydayTransaction(payDate);

            pt.Execute();

            var pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEndDate);
            Assert.AreEqual(8 * 15.24, pc.GrossPay, 0.001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(9.42 + 19.42, pc.Deductions, 0.001);
            Assert.AreEqual(8 * 15.24 - (9.42 + 19.42), pc.NetPay, 0.001);
        }
Exemplo n.º 19
0
        public void PaySingleHourlyEmployeeWrongDate()
        {
            int               empId      = 1;
            string            name       = "Bogdan";
            string            address    = "Home";
            double            hourlyRate = 15.25;
            int               hours      = 8;
            AddHourlyEmployee t          = new AddHourlyEmployee(empId, name, address, hourlyRate);

            t.Execute();
            DateTime            payDate = new DateTime(2001, 11, 8);
            TimeCardTransaction tc      = new TimeCardTransaction(payDate, hours, empId);

            tc.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate);

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

            Assert.IsNull(pc);
        }
Exemplo n.º 20
0
        public void PaySingleHourlyEmployeeTwoTimeCards()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();

            DateTime payDate = new DateTime(2001, 11, 9); // Friday

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

            tc.Execute();
            TimeCardTransaction tc2 = new TimeCardTransaction(payDate.AddDays(-1), 5.0, empId, database);

            tc2.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate, database);

            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 7 * 15.25);
        }
Exemplo n.º 21
0
        public void TimeCardTransaction()
        {
            int empid           = 6;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 23.41);

            t.Execute();
            TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2015, 10, 31), 8.0, empid);

            tct.Execute();
            Employee e = PayrollDatabase.GetEmployee_Static(empid);

            Assert.IsNotNull(e);
            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;
            TimeCard             tc = hc.GetTimeCard(new DateTime(2015, 10, 31));

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }
Exemplo n.º 22
0
        public void TestPaySingleHourlyEmployeeWithTimeCardsSpanningTwoPayPeriods()
        {
            const int empId = 24;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();
            // Friday
            var payDate = new DateTime(2020, 11, 6);
            var dateInPreviousPayPeriod = new DateTime(2020, 10, 30);

            var tc = new TimeCardTransaction(payDate, 2.0, empId);

            tc.Execute();
            var tc2 = new TimeCardTransaction(dateInPreviousPayPeriod, 5.0, empId);

            tc2.Execute();
            var pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidateHourlyPaycheck(pt, empId, payDate, 2 * 15.25);
        }
Exemplo n.º 23
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);
        }
Exemplo n.º 24
0
        public void TestServiceChargesSpanningMultiplePayPeriods()
        {
            var empId = 1;
            var addTx = new AddHourlyEmployee(empId, "Bill", "Home", 15.24M);

            addTx.Execute();
            int memberId = 7734;
            var memberTx = new ChangeMemberTransaction(empId, memberId, 9.42M);

            memberTx.Execute();
            var earlyDate = new Date(11, 2, 2001);  //previous friday
            var payDate   = new Date(11, 9, 2001);
            var lateDate  = new Date(11, 16, 2001); //this friday

            var serviceChargeTx1 = new ServiceChargeTransaction(memberId, payDate, 19.42M);

            serviceChargeTx1.Execute();
            var serviceChargeTx2 = new ServiceChargeTransaction(memberId, earlyDate, 100M);

            serviceChargeTx2.Execute();
            var serviceChargeTx3 = new ServiceChargeTransaction(memberId, lateDate, 200M);

            serviceChargeTx3.Execute();

            var timecardTx = new TimeCardTransaction(payDate, 8, empId);

            timecardTx.Execute();

            var payDayTx = new PaydayTransaction(payDate);

            payDayTx.Execute();
            var paycheck = payDayTx.GetPaycheck(empId);

            Assert.IsNotNull(paycheck, "No paycheck available");
            Assert.AreEqual(payDate, paycheck.PayPeriodEndDate);
            Assert.AreEqual(8 * 15.24M, paycheck.GrossPay);
            Assert.AreEqual("Hold", paycheck.GetField("Disposition"));
            Assert.AreEqual(9.42M + 19.42M, paycheck.Deductions, "Deductions are incorrect");
            Assert.AreEqual((8 * 15.24M) - (9.42M + 19.42M), paycheck.NetPay);
        }
Exemplo n.º 25
0
        public void TestPaySingleHourlyEmployeeOnWrongDate()
        {
            int empId = 2;
            var addTx = new AddHourlyEmployee(empId, "Bill", "Home", 15.25M);

            addTx.Execute();
            var payDate = new Date(11, 8, 2001);

            Assert.AreEqual(DayOfWeek.Thursday, payDate.DayOfWeek);

            var timecardTx = new TimeCardTransaction(payDate, 9.0M, empId);

            timecardTx.Execute();

            var paydayTx = new PaydayTransaction(payDate);

            paydayTx.Execute();

            var paycheck = paydayTx.GetPaycheck(empId);

            Assert.IsNull(paycheck, "paycheck is available when payday is calculated on a thursday, should only be on friday");
        }
Exemplo n.º 26
0
        public void TestAddHourlyEmployee()
        {
            int empId           = 1;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Йорик", "Гочина 23", 2000.00);

            t.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.AreEqual("Йорик", e.name);
            PaymentClassification pc = e.classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification sc = pc as HourlyClassification;

            Assert.AreEqual(2000.00, sc.HourlyRate, .001);
            PaymentSchedule ps = e.schedule;

            Assert.IsTrue(ps is WeeklySchedule);
            PaymentMethod pm = e.method;

            Assert.IsTrue(pm is HoldMethod);
        }
Exemplo n.º 27
0
        public void PayingSingleHourlyEmployeeWithTimeCardsSpanningTwoPayPeriods()
        {
            int empid           = 24;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 15.25);

            t.Execute();
            DateTime            payDate = new DateTime(2015, 12, 4);
            DateTime            dateInPreviousPayPeriod = new DateTime(2015, 11, 21);
            TimeCardTransaction tc = new TimeCardTransaction(payDate, 2.0, empid);

            tc.Execute();
            TimeCardTransaction tc1 = new TimeCardTransaction(payDate.AddDays(-1), 5.0, empid);

            tc1.Execute();
            TimeCardTransaction tc2 = new TimeCardTransaction(dateInPreviousPayPeriod, 5.0, empid);

            tc2.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidateHourlyPaycheck(pt, empid, payDate, 7 * 15.25);
        }
Exemplo n.º 28
0
        public void AddHourlyEmployee()
        {
            int     emplid           = 2;
            string  address          = "2nd street";
            string  fullName         = "Kyle Kornetzke";
            decimal hourlyRate       = 10.0m;
            AddEmployeeTransaction t = new AddHourlyEmployee(emplid, address, fullName, hourlyRate);

            t.Execute();

            Employee e = Database.GetEmployee(emplid);

            Assert.AreEqual(emplid, e.Emplid);
            Assert.AreEqual(address, e.Address);
            Assert.AreEqual(fullName, e.FullName);

            CheckEmployeePaymentTypes(typeof(HourlyClassification), typeof(HoldMethod), typeof(WeeklySchedule), e);

            HourlyClassification h = e.paymentClassification as HourlyClassification;

            Assert.AreEqual(hourlyRate, h.HourlyRate);
        }
Exemplo n.º 29
0
        public void PaySingleHourlyEmployeeWithTimeCardsSpanningTwoPayPeriods()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();

            DateTime payDate = new DateTime(2001, 11, 9); // Friday
            DateTime dateInPreviousPayPeriod = new DateTime(2001, 11, 2);

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

            tc.Execute();
            TimeCardTransaction tc2 = new TimeCardTransaction(dateInPreviousPayPeriod, 5.0, empId, database);

            tc2.Execute();
            PaydayTransaction pt = new PaydayTransaction(payDate, database);

            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 2 * 15.25);
        }
Exemplo n.º 30
0
        public void ExecuteTest_ServiceChargesSpanningMultiplePayPeriods()
        {
            int empId           = 1;
            AddHourlyEmployee t = new AddHourlyEmployee(
                empId, "Bill", "Home", 15.24, database);

            t.Execute();
            int memberId = 7734;
            ChangeMemberTransaction cmt =
                new ChangeMemberTransaction(empId, memberId, 9.42, database);

            cmt.Execute();
            DateTime payDate   = new DateTime(2001, 11, 9);
            DateTime earlyDate =
                new DateTime(2001, 11, 2);  // previous Friday
            DateTime lateDate =
                new DateTime(2001, 11, 16); // next Friday
            ServiceChargeTransaction sct =
                new ServiceChargeTransaction(memberId, 19.42, payDate, database);

            sct.Execute();
            ServiceChargeTransaction sctEarly =
                new ServiceChargeTransaction(memberId, 100.00, earlyDate, database);

            sctEarly.Execute();
            ServiceChargeTransaction sctLate =
                new ServiceChargeTransaction(memberId, 200.00, lateDate, database);

            sctLate.Execute();
            TimeCardTransaction tct =
                new TimeCardTransaction(payDate, 8.0, empId, database);

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

            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 8 * 15.24, 9.42 + 19.42);
        }
Exemplo n.º 31
0
        public void AddHourlyEmployee()
        {
            int empid           = 3;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Home", 265);

            t.Execute();
            Employee e = PayrollDatabase.GetEmployee_Static(empid);

            Assert.AreEqual("Bill", e.Name);
            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification sc = pc as HourlyClassification;

            Assert.AreEqual(265, sc.Hourly, .001);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is WeeklySchedule);
            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Exemplo n.º 32
0
        public void ExecuteTest()
        {
            int    empId  = 23;
            double salary = 1600;

            AddEmployeeTransaction addHourlyEmp = new AddHourlyEmployee(empId, "kara", "samubola", 3000, database);

            addHourlyEmp.Execute();

            ChangeClassificationTranscation changeHourlyTrans = new ChangeSalariedTransaction(empId, salary, database);

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

            Assert.IsNotNull(emp);
            Assert.IsTrue(emp.Classification is SalariedClassification);

            SalariedClassification hc = emp.Classification as SalariedClassification;

            Assert.IsNotNull(hc);
            Assert.AreEqual(hc.Salary, salary);
        }
Exemplo n.º 33
0
 public void TimeCardTransaction()
 {
     int empId = 5;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2015, 10, 31), 8.0, empId);
     tct.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
 }