Пример #1
0
        public void TestHourlyUnionMemberServiceCharge()
        {
            const int empId = 26;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.24);

            t.Execute();
            const int memberId = 7735;
            var       cmt      = new ChangeMemberTransaction(empId, memberId, 9.42);

            cmt.Execute();
            var payDate = new DateTime(2020, 11, 6);
            var sct     = new ServiceChargeTransaction(memberId, payDate, 19.42);

            sct.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);
        }
Пример #2
0
        public void TestPaySingleHourlyEmployeeOvertimeOneTimeCard()
        {
            const int empId = 21;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

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

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

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

            pt.Execute();
            ValidateHourlyPaycheck(pt, empId, payDate, (8 + 1.5) * 15.25);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
0
        public void TestTimeCardTransaction()
        {
            const int empId = 5;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();
            var tct = new TimeCardTransaction(new DateTime(2020, 7, 31), 8.0, empId);

            tct.Execute();

            var e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            var pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            var hc = pc as HourlyClassification;

            var tc = hc.GetTimeCard(new DateTime(2020, 7, 31));

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours, 0.001);
        }