Beispiel #1
0
        public void HourlyUnionMemberServiceCharge()
        {
            int       empId    = SetupHourlyEmployee();
            const int memberId = 7734;
            var       cmt      = new ChangeMemberTransaction(empId, memberId, 9.42);

            cmt.Execute();

            var payDate = new DateTime(2001, 11, 9);
            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();

            Paycheck pc = PaydayTransaction.GetPaycheck(empId);

            Assert.NotNull(pc);
            Assert.Equal(payDate, pc.PayPeriodEndDate);
            Assert.Equal(8 * 15.25, pc.GrossPay);
            Assert.Equal("Hold", pc.GetField("Disposition"));
            Assert.Equal(9.42 + 19.42, pc.Deductions);
            Assert.Equal((8 * 15.25) - (9.42 + 19.42), pc.NetPay);
        }
Beispiel #2
0
        public void HourlyUnionMemberServiceCharge()
        {
            int empid           = 31;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Home", 15.24);

            t.Execute();
            int memberId = 7664;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empid, memberId, 9.42);

            cmt.Execute();
            DateTime payDate             = new DateTime(2015, 11, 27);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42);

            sct.Execute();
            TimeCardTransaction tct = new TimeCardTransaction(payDate, 8.0, empid);

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

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

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEndDate);
            Assert.AreEqual(8 * 15.24, pc.GrossPay, .001);
            Assert.AreEqual("HOLD", pc.GetField("Disposition"));
            Assert.AreEqual(9.42 + 19.42, pc.Deductions, .001);
            Assert.AreEqual((8 * 15.24) - (9.42 + 19.42), pc.NetPay, .001);
        }
Beispiel #3
0
        public void TestSalariedUnionMemberDues()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(empId, "Kubing", "Home", 1000.0, database);

            t.Execute();

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

            cmt.Execute();

            DateTime          payDate = new DateTime(2001, 11, 30);
            PaydayTransaction pt      = new PaydayTransaction(payDate, database);

            pt.Execute();

            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEnd);
            Assert.AreEqual(1000.0, pc.GrossPay, 0.001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(9.42 * 5, pc.Deductions, 0.001);
            Assert.AreEqual(1000.0 - 9.42 * 5, pc.NetPay, 0.001);
        }
Beispiel #4
0
        public void TestHourlyUnionMemberServiceCharge()
        {
            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);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42, database);

            sct.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);
        }
        private void ValidateHourlyPaycheck(PaydayTransaction pt, int empid, DateTime payDate, double pay)
        {
            Paycheck pc = pt.GetPaycheck(empid, payDate);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(pay, pc.GrossPay, .001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, .001);
            Assert.AreEqual(pay, pc.NetPay, .001);
        }
Beispiel #6
0
        private void ValidateCommissionedPaycheck(PaydayTransaction pt, int empId, DateTime payDate, double pay)
        {
            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEnd);
            Assert.AreEqual(pay, pc.GrossPay, 0.01);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, 0.01);
            Assert.AreEqual(pay, pc.NetPay, 0.01);
        }
Beispiel #7
0
        private static void ValidateNoDeductionPaycheck(int empId, DateTime payDate, double pay)
        {
            Paycheck pc = PaydayTransaction.GetPaycheck(empId);

            Assert.NotNull(pc);
            Assert.Equal(payDate, pc.PayPeriodEndDate);
            Assert.Equal(pay, pc.GrossPay);
            Assert.Equal("Hold", pc.GetField("Disposition"));
            Assert.Equal(0.0, pc.Deductions);
            Assert.Equal(pay, pc.NetPay);
        }
Beispiel #8
0
        public void 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, 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.PayPeriodEndDate);
            Assert.AreEqual(8 * 15.24, pc.GrossPay, .001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(9.42 + 19.42, pc.Deductions, .001);
            Assert.AreEqual((8 * 15.24) - (9.42 + 19.42), pc.NetPay, .001);
        }
Beispiel #9
0
        public async Task PaySingleSalariedEmployee()
        {
            int empId             = 10;
            AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00);
            await t.ExecuteAsync();

            DateTime          payDate = new DateTime(2001, 11, 30);
            PaydayTransaction pt      = new PaydayTransaction(payDate);
            await pt.ExecuteAsync();

            Paycheck pc = pt.GetPaycheck(empId);

            Assert.NotNull(pc);
            Assert.Equal(payDate, pc.PayPeriodEndDate);
            Assert.Equal(1000, pc.GrossPay);
            Assert.Equal("Hold", pc.GetField("Disposition"));
            Assert.Equal(0, pc.Deduction);
            Assert.Equal(1000, pc.NetPay);
        }
Beispiel #10
0
        public void PaySingleSalariedEmployee()
        {
            int empid             = 17;
            AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bill", "Home", 1000.00);

            t.Execute();
            DateTime          payDate = new DateTime(2001, 11, 30);
            PaydayTransaction pt      = new PaydayTransaction(payDate);

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

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(1000.00, pc.GrossPay, .001);
            Assert.AreEqual("HOLD", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, .001);
            Assert.AreEqual(1000.00, pc.NetPay, .001);
        }
Beispiel #11
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);
        }
Beispiel #12
0
        public void PayingSingleCommissionedEmployeeNoSalaryCards()
        {
            int empid = 25;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empid, "Bill", "Home", 15000, 10);

            t.Execute();
            DateTime          payDate = new DateTime(2015, 12, 4);
            PaydayTransaction pt      = new PaydayTransaction(payDate);

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

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(15000, pc.GrossPay);
            Assert.AreEqual("HOLD", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, .001);
            Assert.AreEqual(15000, pc.NetPay, .001);
        }
Beispiel #13
0
        public void TestPaySingleSalariedEmployee()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(empId, "Kubing", "Home", 1000.00, database);

            t.Execute();

            DateTime          payDate = new DateTime(2001, 11, 30);
            PaydayTransaction pt      = new PaydayTransaction(payDate, database);

            pt.Execute();

            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEnd);
            Assert.AreEqual(1000.00, pc.GrossPay, 0.001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, 0.001);
            Assert.AreEqual(1000.00, pc.NetPay, 0.001);
        }
Beispiel #14
0
        public void SalariedUnionMemberDues()
        {
            int       empId    = SetupSalariedEmployee();
            const int memberId = 7734;
            var       cmt      = new ChangeMemberTransaction(empId, memberId, 9.42);

            cmt.Execute();
            var payDate = new DateTime(2001, 11, 30);
            var pt      = new PaydayTransaction(payDate);

            pt.Execute();

            Paycheck pc = PaydayTransaction.GetPaycheck(empId);

            Assert.NotNull(pc);
            Assert.Equal(payDate, pc.PayPeriodEndDate);
            Assert.Equal(2300.0, pc.GrossPay);
            Assert.Equal("Hold", pc.GetField("Disposition"));
            Assert.Equal(5 * 9.42, pc.Deductions);
            Assert.Equal(2300.0 - 5 * 9.42, pc.NetPay);
        }
        public void PaySingleSalariedEmployee()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00);

            t.Execute();

            DateTime          payDate = new DateTime(2001, 11, 30); // paid on the last working day of the month
            PaydayTransaction pt      = new PaydayTransaction(payDate);

            pt.Execute();

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

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(1000.00, pc.GrossPay, .001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, .001);
            Assert.AreEqual(1000.00, pc.NetPay, .001);
        }
Beispiel #16
0
        public void PaySingleCommissionedEmployeeNoSalesReceipts()
        {
            int empId = 1;
            AddCommissionedEmployee t = new AddCommissionedEmployee(
                empId, "Bob", "Home", 1000.00, 10, database);

            t.Execute();

            DateTime          payDate = new DateTime(2001, 11, 16); // Friday
            PaydayTransaction pt      = new PaydayTransaction(payDate, database);

            pt.Execute();

            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEndDate);
            Assert.AreEqual(1000.00, pc.GrossPay, .001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, .001);
            Assert.AreEqual(1000.00, pc.NetPay, .001);
        }
Beispiel #17
0
        public void ServiceChargesSpanningMultiplePayPeriods()
        {
            int       empId    = SetupHourlyEmployee();
            const int memberId = 7734;
            var       cmt      = new ChangeMemberTransaction(empId, memberId, 9.42);

            cmt.Execute();

            var payDate   = new DateTime(2001, 11, 9);
            var earlyDate = new DateTime(2001, 11, 2);  // previous Friday
            var lateDate  = new DateTime(2001, 11, 16); // next Friday

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

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

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

            sctLate.Execute();

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

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

            pt.Execute();

            Paycheck pc = PaydayTransaction.GetPaycheck(empId);

            Assert.NotNull(pc);
            Assert.Equal(payDate, pc.PayPeriodEndDate);
            Assert.Equal(8 * 15.25, pc.GrossPay);
            Assert.Equal("Hold", pc.GetField("Disposition"));
            Assert.Equal(9.42 + 19.42, pc.Deductions);
            Assert.Equal((8 * 15.25) - (9.42 + 19.42), pc.NetPay);
        }
Beispiel #18
0
        public void SalariedUnionMemberDues()
        {
            int empid             = 30;
            AddSalariedEmployee t = new AddSalariedEmployee(empid, "Bob", "Home", 1000.00);

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

            cmt.Execute();
            DateTime          payDate = new DateTime(2015, 10, 31);
            PaydayTransaction pt      = new PaydayTransaction(payDate);

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

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(1000.00, pc.GrossPay, .001);
            Assert.AreEqual("HOLD", pc.GetField("Disposition"));
            Assert.AreEqual(9.42 * 5, pc.Deductions, .001);
            Assert.AreEqual(1000.00 - 9.42 * 5, pc.NetPay, .001);
        }
Beispiel #19
0
        public void ServiceChargesSpanningmultiplePayPeriods()
        {
            int empid           = 32;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 15.24);

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

            cmt.Execute();
            DateTime payDate             = new DateTime(2015, 12, 11);
            DateTime earlyDate           = new DateTime(2015, 12, 4);
            DateTime lateDate            = new DateTime(2015, 12, 18);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42);

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

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

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

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

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

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayPeriodEndDate);
            Assert.AreEqual(8 * 15.24, pc.GrossPay, .001);
            Assert.AreEqual("HOLD", pc.GetField("Disposition"));
            Assert.AreEqual(9.42 + 19.42, pc.Deductions, .001);
            Assert.AreEqual((8 * 15.24) - (9.42 + 19.42), pc.NetPay, .001);
        }