Ejemplo n.º 1
0
        public void TestChangeMemberTransaction()
        {
            int empId    = 2;
            int memberId = 7734;

            var addTx = new AddHourlyEmployee(empId, "Bill", "Home", 15.25M);

            addTx.Execute();
            var changeMemberTx = new ChangeMemberTransaction(empId, memberId, 99.42M);

            changeMemberTx.Execute();

            var employee = Database.GetEmployee(empId);

            Assert.IsNotNull(employee, "Employee not found");

            var affiliation = employee.Affiliation;

            Assert.IsInstanceOfType(affiliation, typeof(UnionAffiliation), "Not union affiliation");
            var unionAffiliation = (UnionAffiliation)affiliation;

            Assert.AreEqual(99.42M, unionAffiliation.Dues);

            var member = Database.GetUnionMember(memberId);

            Assert.IsNotNull(member, "Member not found");
            Assert.AreEqual(employee, member);
        }
Ejemplo n.º 2
0
        public void TestUnaffiliatedTransaction()
        {
            int empId    = 2;
            int memberId = 7734;

            var addTx = new AddHourlyEmployee(empId, "Bill", "Home", 15.25M);

            addTx.Execute();
            var changeMemberTx = new ChangeMemberTransaction(empId, memberId, 99.42M);

            changeMemberTx.Execute();


            var changeUnaffiliatedTx = new ChangeUnaffiliatedTransaction(empId);

            changeUnaffiliatedTx.Execute();

            var employee = Database.GetEmployee(empId);

            Assert.IsNotNull(employee, "Employee not found");

            var affiliation = employee.Affiliation;

            Assert.IsInstanceOfType(affiliation, typeof(NoAffiliation), "Has a union affiliation");

            var member = Database.GetUnionMember(memberId);

            Assert.IsNull(member, "Membership was not removed from database");
        }
Ejemplo n.º 3
0
        public void ChangeUnionMember()
        {
            int empId           = 8;
            AddHourlyEmployee t =
                new AddHourlyEmployee(empId, "Билл", "Домашний", 15.25);

            t.Execute();
            int memberId = 7743;
            ChangeMemberTransaction cmt =
                new ChangeMemberTransaction(empId, memberId, 99.42);

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

            Assert.IsNotNull(e);
            Affiliation affiliation = e.Affiliation;

            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is UnionAffiliation);
            UnionAffiliation uf = affiliation as UnionAffiliation;

            Assert.AreEqual(99.42, uf.Dues);
            Employee member = PayrollDatabase.GetUnionMember(memberId);

            Assert.IsNotNull(member);
            Assert.AreEqual(e, member);
        }
Ejemplo n.º 4
0
        public void TestHourlyUnionMemberServiceCharge()
        {
            const int empId = 26;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.24);

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

            cmt.Execute();
            var payDate = new DateTime(2020, 11, 6);
            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();

            var 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);
        }
Ejemplo n.º 5
0
        public void TestChangeUnionMember()
        {
            const int empId = 16;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();
            const int memberId = 7743;
            var       cmt      = new ChangeMemberTransaction(empId, memberId, 99.42);

            cmt.Execute();
            var e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);
            var affiliation = e.Affiliation;

            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is UnionAffiliation);
            var uf = affiliation as UnionAffiliation;

            Assert.AreEqual(99.42, uf.Dues, 0.001);
            var member = PayrollDatabase.GetUnionMember(memberId);

            Assert.IsNotNull(member);
            Assert.AreEqual(e, member);
        }
Ejemplo n.º 6
0
        public void TestHourlyUnionMemberServiceCharge()
        {
            var empId = 1;
            var addTx = new AddHourlyEmployee(empId, "Bill", "Home", 15.24M);

            addTx.Execute();
            int memberId = 7734;
            var memberTx = new ChangeMemberTransaction(empId, memberId, 9.42M);

            memberTx.Execute();
            var payDate         = new Date(11, 9, 2001);
            var serviceChargeTx = new ServiceChargeTransaction(memberId, payDate, 19.42M);

            serviceChargeTx.Execute();
            var timecardTx = new TimeCardTransaction(payDate, 8, empId);

            timecardTx.Execute();
            var payDayTx = new PaydayTransaction(payDate);

            payDayTx.Execute();
            var paycheck = payDayTx.GetPaycheck(empId);

            Assert.IsNotNull(paycheck, "No paycheck available");
            Assert.AreEqual(payDate, paycheck.PayPeriodEndDate);
            Assert.AreEqual(8 * 15.24M, paycheck.GrossPay);
            Assert.AreEqual("Hold", paycheck.GetField("Disposition"));
            Assert.AreEqual(9.42M + 19.42M, paycheck.Deductions);
            Assert.AreEqual((8 * 15.24M) - (9.42M + 19.42M), paycheck.NetPay);
        }
        public void RemoveMembership()
        {
            int empId           = 8;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();

            int memberId = 7743; // Some Union
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, 99.42);

            cmt.Execute();

            ChangeUnaffiliatedTransaction cut = new ChangeUnaffiliatedTransaction(empId);

            cut.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            Affiliation affiliation = e.Affiliation;

            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is NoAffiliation);

            Employee member = PayrollDatabase.GetUnionMember(memberId);

            Assert.IsNull(member);
        }
Ejemplo n.º 8
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);
        }
Ejemplo n.º 9
0
        public void ExecuteTest()
        {
            int    empId    = 33;
            int    memberId = 987;
            double dues     = 98.6;

            AddSalariedEmployee addSalEmp = new AddSalariedEmployee(empId, "Masa", "Faav Street", 5000, database);

            addSalEmp.Execute();
            ChangeAffiliationTransaction changeAffTrans = new ChangeMemberTransaction(empId, memberId, dues, database);

            changeAffTrans.Execute();

            Employee emp = database.GetEmployee(empId);

            Assert.IsNotNull(emp);
            Assert.IsTrue(emp.Affiliation is UnionAffiliation);

            UnionAffiliation ua = emp.Affiliation as UnionAffiliation;

            Assert.IsNotNull(ua);
            Assert.AreEqual(ua.Dues, dues);

            Employee member = database.GetUnionMember(memberId);

            Assert.IsNotNull(member);
            Assert.AreEqual(emp, member);
        }
Ejemplo n.º 10
0
        public void ChangeUnionMember()
        {
            int empId           = 9;
            AddHourlyEmployee t =
                new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();
            int memberId = 7743;
            ChangeMemberTransaction cmt =
                new ChangeMemberTransaction(empId, memberId, 99.42, database);

            cmt.Execute();
            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);
            Affiliation affiliation = e.Affiliation;

            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is UnionAffiliation);
            UnionAffiliation uf = affiliation as UnionAffiliation;

            Assert.AreEqual(99.42, uf.Dues, .001);
            Employee member = database.GetUnionMember(memberId);

            Assert.IsNotNull(member);
            Assert.AreEqual(e, member);
        }
Ejemplo n.º 11
0
        public void ChangeUnaffiliatedTransaction()
        {
            var empId = SetupHourlyEmployee();
            // Make sure the employee is union affiliated
            const int memberId = 7743;
            var       cmt      = new ChangeMemberTransaction(empId, memberId, 99.42);

            cmt.Execute();

            var cut = new ChangeUnaffiliatedTransaction(empId);

            cut.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.NotNull(e);

            Affiliation affiliation = e.Affiliation;

            Assert.NotNull(affiliation);

            Assert.IsType <NoAffiliation>(affiliation);
            Employee member = PayrollDatabase.GetUnionMember(memberId);

            Assert.Null(member);
        }
        public void ChangeUnionMember()
        {
            int employeeId           = 18;
            AddEmployTransaction aet = new AddHourlyEmployee(employeeId, "Bill", "home", 19.1);

            aet.Execute();

            int memberId = 8591;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(employeeId, memberId, 99.42);

            cmt.Execute();

            Employee e = PayrollRepository.GetEmployee(employeeId);

            e.Should().NotBeNull();
            e.Affiliation.Should().NotBeNull();
            e.Affiliation.Should().BeOfType <UnionAffiliation>();

            UnionAffiliation uf = e.Affiliation as UnionAffiliation;

            uf.Dues.Should().Be(99.42);
            Employee member = PayrollRepository.GetUnionMember(memberId);

            member.Should().NotBeNull();
            member.Should().Be(e);
        }
Ejemplo n.º 13
0
        public void UnionMemberWithTwoServiceCharge()
        {
            database.AddEmployee(employee);

            int memberId = 7783;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(employee.EmpId, memberId, 99.42, database);

            cmt.Execute();

            var date = new DateTime(2005, 8, 8);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, date, 12.95, database);

            sct.Execute();

            var date2 = new DateTime(2005, 8, 15);
            ServiceChargeTransaction sct2 = new ServiceChargeTransaction(memberId, date2, 4.52, database);

            sct2.Execute();

            var serviceCharges = database.GetServiceCharges(memberId);

            Assert.AreEqual(2, serviceCharges.Count);

            ServiceCharge sc1 = serviceCharges[0];

            Assert.IsNotNull(sc1);
            Assert.AreEqual(12.95, sc1.Amount, 0.001);

            ServiceCharge sc2 = serviceCharges[1];

            Assert.IsNotNull(sc2);
            Assert.AreEqual(4.52, sc2.Amount, 0.001);
        }
Ejemplo n.º 14
0
        public void ChangeUnionMember()
        {
            int       empId    = SetupHourlyEmployee();
            const int memberId = 7743;

            var cmt = new ChangeMemberTransaction(empId, memberId, 99.42);

            cmt.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.NotNull(e);

            Affiliation affiliation = e.Affiliation;

            Assert.NotNull(affiliation);

            var uf = Assert.IsType <UnionAffiliation>(affiliation);

            Assert.Equal(99.42, uf.Dues);

            Employee member = PayrollDatabase.GetUnionMember(memberId);

            Assert.NotNull(member);
            Assert.Same(e, member);
        }
Ejemplo n.º 15
0
        public void TestChangeMemberTransaction()
        {
            int empId           = 9;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 25.32, database);

            t.Execute();

            int memberId = 7783;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, 99.42, database);

            cmt.Execute();

            Employee    e           = database.GetEmployee(empId);
            Affiliation affiliation = e.Affiliation;

            Assert.IsNotNull(e);
            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is UnionAffiliation);

            UnionAffiliation ua = e.Affiliation as UnionAffiliation;

            Assert.AreEqual(99.42, ua.Dues, 0.001);

            Employee member = database.GetUnionMember(memberId);

            Assert.IsNotNull(member);
            Assert.AreEqual(e, member);
        }
Ejemplo n.º 16
0
        public void SalariedUnionMemberDuesTest()
        {
            var empId             = 1;
            var name              = "Bogdan";
            var address           = "Home";
            var salary            = 1000.0;
            AddSalariedEmployee t = new AddSalariedEmployee(empId, name, address, salary);

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

            cmt.Execute();
            var 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(salary, pc.GrossPay, .001);
            Assert.AreEqual(5 * dues, pc.Deductions, .001);
            Assert.AreEqual(salary - (5 * dues), pc.NetPay, .001);
        }
Ejemplo n.º 17
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);
        }
        public void ChangeUnaffiliatedTransaction()
        {
            int employeeId           = 19;
            AddEmployTransaction aet = new AddHourlyEmployee(employeeId, "Bill", "home", 19.1);

            aet.Execute();
            int memberId = 8592;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(employeeId, memberId, 99.42);

            cmt.Execute();
            Employee um = PayrollRepository.GetUnionMember(memberId);

            um.Should().NotBeNull();
            ChangeUnaffiliatedTransaction cut = new ChangeUnaffiliatedTransaction(employeeId);

            cut.Execute();

            Employee e = PayrollRepository.GetEmployee(employeeId);

            e.Should().NotBeNull();
            e.Affiliation.Should().NotBeNull();
            e.Affiliation.Should().BeOfType <NoAffiliaction>();

            Employee member = PayrollRepository.GetUnionMember(memberId);

            member.Should().BeNull();
        }
Ejemplo n.º 19
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);
        }
Ejemplo n.º 20
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);
        }
Ejemplo n.º 21
0
        public void ExecuteTest_HourlyUnionMemberServiceCharge()
        {
            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);
            ServiceChargeTransaction sct =
                new ServiceChargeTransaction(memberId, 19.42, payDate, database);

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

            tct.Execute();
            PayDayTransaction pt = new PayDayTransaction(payDate, database);

            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 8 * 15.24, 9.42 + 19.42);
        }
Ejemplo n.º 22
0
        public void RemoveUnionMember()
        {
            database.AddEmployee(employee);

            int memberId = 7783;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(employee.EmpId, memberId, 99.42, database);

            cmt.Execute();

            ChangeUnaffiliatedTransaction cut = new ChangeUnaffiliatedTransaction(employee.EmpId, database);

            cut.Execute();

            var unionMember = database.GetUnionMember(memberId);

            Assert.IsNull(unionMember);
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
0
        public void ExecuteTest_SalariedUnionMemberDues()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(
                empId, "Bob", "Home", 1000.00, database);

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

            cmt.Execute();
            DateTime          payDate = new DateTime(2014, 3, 31); //有4个周五
            PayDayTransaction pt      = new PayDayTransaction(payDate, database);

            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 1000.0, 9.42 * 4);
        }
Ejemplo n.º 25
0
        public void UnionMemberWithOneServiceCharge()
        {
            database.AddEmployee(employee);

            int memberId = 7783;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(employee.EmpId, memberId, 99.42, database);

            cmt.Execute();

            var date = new DateTime(2005, 8, 8);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, date, 12.95, database);

            sct.Execute();

            var           serviceCharges = database.GetServiceCharges(memberId);
            ServiceCharge sc             = serviceCharges.FirstOrDefault(x => x.Date == date);

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Amount, 0.001);
        }
Ejemplo n.º 26
0
        public void LoadUnionMember()
        {
            database.AddEmployee(employee);

            int memberId = 7783;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(employee.EmpId, memberId, 99.42, database);

            cmt.Execute();

            var unionMember = database.GetUnionMember(memberId);

            Assert.AreEqual(employee.EmpId, unionMember.EmpId);
            Assert.AreEqual(employee.Name, unionMember.Name);
            Assert.AreEqual(employee.Address, unionMember.Address);

            var unionAffiliation = unionMember.Affiliation as UnionAffiliation;

            Assert.AreEqual(memberId, unionAffiliation.MemberId);
            Assert.AreEqual(99.42, unionAffiliation.Dues, .01);
        }
Ejemplo n.º 27
0
        public void UnionMemberGetsSaved()
        {
            database.AddEmployee(employee);

            int memberId = 7783;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(employee.EmpId, memberId, 99.42, database);

            cmt.Execute();

            var affiliationTable = LoadTable("Affiliation");
            var affiliationRow   = affiliationTable.Rows[0];

            Assert.AreEqual(memberId, affiliationRow["Id"]);
            Assert.AreEqual(99.42, double.Parse(affiliationRow["Dues"].ToString()), .01);

            var employeeAffiliationTable = LoadTable("EmployeeAffiliation");
            var employeeAffiliationRow   = employeeAffiliationTable.Rows[0];

            Assert.AreEqual(memberId, employeeAffiliationRow["AffiliationId"]);
            Assert.AreEqual(employee.EmpId, employeeAffiliationRow["EmpId"]);
        }
Ejemplo n.º 28
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);
        }
Ejemplo n.º 29
0
        public void TestServiceChargesSpanningMultiplePayPeriods()
        {
            var empId = 1;
            var addTx = new AddHourlyEmployee(empId, "Bill", "Home", 15.24M);

            addTx.Execute();
            int memberId = 7734;
            var memberTx = new ChangeMemberTransaction(empId, memberId, 9.42M);

            memberTx.Execute();
            var earlyDate = new Date(11, 2, 2001);  //previous friday
            var payDate   = new Date(11, 9, 2001);
            var lateDate  = new Date(11, 16, 2001); //this friday

            var serviceChargeTx1 = new ServiceChargeTransaction(memberId, payDate, 19.42M);

            serviceChargeTx1.Execute();
            var serviceChargeTx2 = new ServiceChargeTransaction(memberId, earlyDate, 100M);

            serviceChargeTx2.Execute();
            var serviceChargeTx3 = new ServiceChargeTransaction(memberId, lateDate, 200M);

            serviceChargeTx3.Execute();

            var timecardTx = new TimeCardTransaction(payDate, 8, empId);

            timecardTx.Execute();

            var payDayTx = new PaydayTransaction(payDate);

            payDayTx.Execute();
            var paycheck = payDayTx.GetPaycheck(empId);

            Assert.IsNotNull(paycheck, "No paycheck available");
            Assert.AreEqual(payDate, paycheck.PayPeriodEndDate);
            Assert.AreEqual(8 * 15.24M, paycheck.GrossPay);
            Assert.AreEqual("Hold", paycheck.GetField("Disposition"));
            Assert.AreEqual(9.42M + 19.42M, paycheck.Deductions, "Deductions are incorrect");
            Assert.AreEqual((8 * 15.24M) - (9.42M + 19.42M), paycheck.NetPay);
        }
Ejemplo n.º 30
0
        public void ExecuteTest_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, 19.42, payDate, database);

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

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

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

            tct.Execute();
            PayDayTransaction pt = new PayDayTransaction(payDate, database);

            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 8 * 15.24, 9.42 + 19.42);
        }