Exemplo n.º 1
0
        public void TestHourlyUnionMemberServiceCharge()
        {
            int empId = 12;
            var t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.24m);

            t.Execute();

            int memberId = 1337;
            var cmt      = new ChangeMemberTransaction(empId, memberId, 9.42m);

            cmt.Execute();
            DateTime payDate             = new DateTime(2020, 03, 20);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42m);

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

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

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

            ValidatePaycheck(pt, empId, payDate, 8 * 15.24m, 9.42m + 19.42m);
        }
Exemplo n.º 2
0
        public void TestServiceChargesSpanningMultiplePayPeriods()
        {
            int empId = 1;
            var t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.23m);

            t.Execute();

            int memberId = 1234;
            var cmt      = new ChangeMemberTransaction(empId, memberId, 9.42m);

            cmt.Execute();

            var payDate   = new DateTime(2020, 03, 20);
            var earlyDate = new DateTime(2020, 03, 13);
            var lateDate  = new DateTime(2020, 03, 27);

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

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

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

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

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

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, 8 * 15.23m, 9.42m + 19.42m);
        }
Exemplo n.º 3
0
        public void TestPaySingleHourlyEmployeeOvertimeOneTimeCard()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m);

            t.Execute();
            DateTime payDate = new DateTime(2020, 2, 7);

            TimeCardTransaction tct = new TimeCardTransaction(payDate, 9.0, empId);

            tct.Execute();

            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, (8m + 1.5m) * 15.25m);
        }
Exemplo n.º 4
0
        public void TestPaySingleHourlyEmployeeTwoTimeCards()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m);

            t.Execute();
            DateTime payDate = new DateTime(2020, 2, 7);

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

            tct.Execute();
            TimeCardTransaction tct2 = new TimeCardTransaction(payDate.AddDays(-5), 5.0, empId);

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

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, 7m * 15.25m);
        }
Exemplo n.º 5
0
        public void TestPaySingleHourlyEmployeeOnWrongDate()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m);

            t.Execute();
            DateTime payDate = new DateTime(2020, 2, 6);

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

            tct.Execute();

            PaydayTransaction pt = new PaydayTransaction(payDate);

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

            Assert.That(pc, Is.Null);
        }
Exemplo n.º 6
0
        public void TestPaySingleHourlyEmployeeWithTimeCardSpanningTwoPayPeriods()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m);

            t.Execute();
            DateTime payDate = new DateTime(2020, 2, 7);
            DateTime dateInPreviousPeriod = payDate.AddDays(-7);

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

            tct.Execute();
            TimeCardTransaction tct2 = new TimeCardTransaction(dateInPreviousPeriod, 10.0, empId);

            tct2.Execute();

            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();
            ValidatePaycheck(pt, empId, payDate, 30.5m);
        }
Exemplo n.º 7
0
        public void TestTimeCardTransaction()
        {
            int empId           = 5;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25m);

            t.Execute();

            TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2020, 02, 02), 8.0, empId);

            tct.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.That(e, Is.Not.Null);

            PaymentClassification pc = e.Classification;

            Assert.That(pc is HourlyClassification, Is.True);
            HourlyClassification hc = pc as HourlyClassification;
            TimeCard             tc = hc.GetTimeCard(new DateTime(2020, 02, 02));

            Assert.That(tc, Is.Not.Null);
            Assert.That(tc.Hours, Is.EqualTo(8.0));
        }