コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public void TestCommissionedUnionMemberDues()
        {
            int empId = 1;
            var t     = new AddCommissionedEmployee(empId, "Bob", "Home", 1000.00m, 1m);

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

            cmt.Execute();

            DateTime payDate = new DateTime(2020, 01, 24);
            var      pt      = new PaydayTransaction(payDate);

            pt.Execute();
            //2 Fridays
            var unionDues = 2m * 9.42m;

            ValidatePaycheck(pt, empId, payDate, 1000m, unionDues);

            payDate = new DateTime(2020, 01, 10);
            pt      = new PaydayTransaction(payDate);
            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 1000m, unionDues);
        }
コード例 #4
0
        public void TestChangeNoAffiliation()
        {
            int empId           = 8;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Lance", "Home", 13.37m);

            t.Execute();
            int memberId = 7742;
            ChangeAffiliationTransaction cat = new ChangeMemberTransaction(empId, memberId, 99.42m);

            cat.Execute();
            ChangeAffiliationTransaction cuat = new ChangeUnaffiliatedTransaction(empId);

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

            Assert.That(e, Is.Not.Null);
            Affiliation affiliation = e.Affiliation;

            Assert.That(affiliation, Is.Not.Null);
            Assert.That(affiliation is NoAffiliation);
            NoAffiliation na     = affiliation as NoAffiliation;
            Employee      member = PayrollDatabase.GetUnionMember(memberId);

            Assert.That(member, Is.Null);
        }
コード例 #5
0
        public void TestHourlyUnionMemberDues()
        {
            int empId = 1;
            var t     = new AddHourlyEmployee(empId, "Bob", "Home", 12.0m);

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

            cmt.Execute();

            DateTime payDate = new DateTime(2020, 01, 24);
            var      pt      = new PaydayTransaction(payDate);

            pt.Execute();

            //1 Friday
            var unionDues = 9.42m;

            ValidatePaycheck(pt, empId, payDate, 0m, unionDues);
        }
コード例 #6
0
        public void TestSalariedUnionMemberDuesFridaysTest()
        {
            int empId = 1;
            var t     = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00m);

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

            cmt.Execute();

            DateTime payDate = new DateTime(2020, 01, 31);
            var      pt      = new PaydayTransaction(payDate);

            pt.Execute();

            //5 Fridays in Jan
            var unionDues = 5m * 9.42m;

            ValidatePaycheck(pt, empId, payDate, 1000m, unionDues);
        }