Esempio n. 1
0
        public void TestServiceChargesSpanningMultiplePayPeriods()
        {
            int empId = 1;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.24);
            t.Execute();
            int memberId = 7734;

            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, 9.42);
            cmt.Execute();
            DateTime payDate = new DateTime(2001, 11, 9);
            DateTime earlyDate = new DateTime(2001, 11, 2);//上一个周五
            DateTime lastDate=new DateTime(2001,11,16);//下个周五


            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, payDate, 19.42);
            sct.Execute();

            ServiceChargeTransaction sctEarly = new ServiceChargeTransaction(memberId, earlyDate, 100);
            sctEarly.Execute();
            ServiceChargeTransaction sctLast = new ServiceChargeTransaction(memberId, lastDate, 200);
            sctLast.Execute();

            TimeCardTransaction tct=new TimeCardTransaction(payDate,8,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, 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);
        }
Esempio n. 2
0
        public void TestSalariedUnionMemberDues()
        {

            int empId = 1;
            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(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.0,pc.GrossPay,0.001);
            Assert.AreEqual("Hold",pc.GetField("Disposition"));
            Assert.AreEqual(0,pc.Deductions,0.001);
            Assert.AreEqual(1000-0, pc.NetPay, 0.001);
        }
Esempio n. 3
0
        public void TestHourlyUnionMemberServiceCharge()
        {
            int empId = 1;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.24);
            t.Execute();
            int memberId = 7734;

            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, 9.42);
            cmt.Execute();
            DateTime payDate = new DateTime(2001, 11, 30);

            ServiceChargeTransaction sct=new ServiceChargeTransaction(memberId,payDate,19.42);
            sct.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,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);
        }
Esempio n. 4
0
        public void TestChangeUnionMember()
        {
            int empId = 8;
            AddHourlyEmployee employee = new AddHourlyEmployee(empId, "Lance", "Home", 15.25);
            employee.Execute();
            int memberId = 7743;
            ChangeMemberTransaction cmt=new ChangeMemberTransaction(empId,memberId,99.42);
            cmt.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);
            Assert.IsNotNull(e);

            IAffiliation affiliation = e.Affiliation;
            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is UnionAffiliation);
            UnionAffiliation uf=affiliation as UnionAffiliation;
            
            Assert.AreEqual(99.42, uf.Dues,0.001);

            Employee member = PayrollDatabase.GetUnionMember(memberId);
            Assert.IsNotNull(member);
            Assert.AreEqual(e,member);
        }