Пример #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);
        }
Пример #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);
        }
Пример #3
0
        public void TestAddServiceCharge()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.75m);

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

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

            UnionAffiliation ua = new UnionAffiliation();

            e.Affiliation = ua;
            int memberId = 86;

            PayrollDatabase.AddUnionMember(memberId, empId);

            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2020, 02, 02), 12.95m);

            sct.Execute();
            ServiceCharge sc = ua.GetServiceCharge(new DateTime(2020, 02, 02));

            Assert.That(sc, Is.Not.Null);
            Assert.That(sc.Amount, Is.EqualTo(12.95m));
        }