Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void AddServiceChargeTests()
        {
            int empId           = 2;
            var name            = "Bartosz";
            var hourlyRate      = 15.25;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, name, "Home", hourlyRate);

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

            Assert.IsNotNull(e);

            var memberId        = 86;
            var dues            = 88.12;
            UnionAffiliation af = new UnionAffiliation(memberId, dues);

            e.Affiliation = af;
            var date   = new DateTime(2005, 8, 8);
            var charge = 12.95;

            PayrollDatabase.AddUnionMember(memberId, e);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, date, charge);

            sct.Execute();
            ServiceCharge sc = af.GetServiceCharge(date);

            Assert.IsNotNull(sc);
            Assert.AreEqual(charge, sc.Amount, .001);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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");
        }
Exemplo n.º 5
0
        public void TestAddHourlyEmployee()
        {
            int empId = 1;
            var t     = new AddHourlyEmployee(empId, "Bob", "Home", 10.0M);

            t.Execute();

            var e = Database.GetEmployee(empId);

            Assert.AreEqual("Bob", e.Name);

            PaymentClassification pc = e.GetClassification();

            HourlyClassification sc = (HourlyClassification)pc;

            Assert.AreEqual(sc.HourlyRate, 10.00M);

            PaymentSchedule ps = e.GetSchedule();

            Assert.IsInstanceOfType(ps, typeof(WeeklySchedule));

            PaymentMethod pm = e.GetMethod();

            Assert.IsInstanceOfType(pm, typeof(HoldMethod));
        }
Exemplo n.º 6
0
        public void TestAddServiceCharge()
        {
            int empId    = 2;
            int memberId = 7734;
            var addTx    = new AddHourlyEmployee(empId, "Bill", "Home", 15.25M);

            addTx.Execute();

            var employee = Database.GetEmployee(empId);

            var unionAffiliation = new UnionAffiliation(memberId, 12.5M);

            employee.Affiliation = unionAffiliation;

            Database.AddUnionMember(memberId, employee);

            var serviceChargeTransaction = new ServiceChargeTransaction(memberId, new Date(11, 01, 2001), 12.95M);

            serviceChargeTransaction.Execute();

            var serviceCharge = unionAffiliation.GetServiceCharge(new Date(11, 01, 2001));

            Assert.IsNotNull(serviceCharge);
            Assert.AreEqual(12.95M, serviceCharge.Amount);
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
        public async Task ChangeUnionMember()
        {
            int empId           = 9;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
            await t.ExecuteAsync();

            int memberId = 7743;
            ChangeMemberTransaction cmt = new ChangeMemberTransaction(empId, memberId, 99.42);
            await cmt.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.NotNull(e);
            IAffiliation affiliation = e.Affiliation;

            Assert.NotNull(affiliation);
            Assert.True(affiliation is UnionAffiliation);
            UnionAffiliation uf = affiliation as UnionAffiliation;

            Assert.Equal(99.42, uf.Dues);
            Employee member = await PayrollDatabase.GetUnionMemberAsync(memberId);

            Assert.NotNull(member);
            Assert.Equal(e, member);
        }
        public void TestAddHourlyEmployee()
        {
            int empId           = 1;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bob", "Home", 13.00);

            t.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.AreEqual("Bob", e.Name);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);

            HourlyClassification cc = pc as HourlyClassification;

            Assert.AreEqual(13.00, cc.HourlyRate, .001);

            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is WeeklySchedule); // They are paid every Friday.

            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Exemplo n.º 10
0
        public void TestAddTimeCard()
        {
            #region Arrange
            int employeeId      = 7;
            AddHourlyEmployee t = new AddHourlyEmployee(employeeId, "user", "home", 97.5);
            t.Execute();

            DateTime            workingDay = new DateTime(2019, 4, 21);
            TimeCardTransaction tct        = new TimeCardTransaction(
                employeeId, workingDay, 8.0
                );
            #endregion

            #region Action
            tct.Execute();
            #endregion

            #region Assert
            Employee e = PayrollRepository.GetEmployee(employeeId);
            e.Should().NotBeNull();

            e.Classification.Should().BeOfType <HourlyClassification>();
            HourlyClassification hc = e.Classification as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(workingDay);
            tc.Should().NotBeNull();
            tc.Hours.Should().Be(8.0);
            #endregion
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        public void ChangeUnaffiliatedMember()
        {
            int empId           = 10;
            AddHourlyEmployee t =
                new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();
            int memberId = 7743;

            new ChangeMemberTransaction(empId, memberId, 99.42, database).Execute();
            ChangeUnaffiliatedTransaction cut =
                new ChangeUnaffiliatedTransaction(empId, database);

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

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

            Assert.IsNotNull(affiliation);
            Assert.IsTrue(affiliation is NoAffiliation);
            Employee member = database.GetUnionMember(memberId);

            Assert.IsNull(member);
        }
Exemplo n.º 13
0
        public void TestAddHourlyEmployee()
        {
            int               empId      = 3;
            string            name       = "Tomasz";
            double            hourlyRate = 20.0;
            AddHourlyEmployee t          = new AddHourlyEmployee(empId, name, "Home", hourlyRate);

            t.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.AreEqual(name, e.Name);

            IPaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);

            HourlyClassification hc = pc as HourlyClassification;

            Assert.AreEqual(hourlyRate, hc.HourlyRate, .001);
            IPaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is WeeklySchedule);

            IPaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
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);
        }
Exemplo n.º 16
0
        public void ExecuteTest_PaySingleHourlyEmployeeTwoTimeCards()
        {
            int empId = 2;

            database.DeleteEmployee(empId);

            AddHourlyEmployee t = new AddHourlyEmployee(
                empId, "Bill", "Home", 15.25, database);

            t.Execute();
            DateTime payDate = new DateTime(2001, 11, 9); // Friday

            TimeCardTransaction tc =
                new TimeCardTransaction(payDate, 2.0, empId, database);

            tc.Execute();
            TimeCardTransaction tc2 =
                new TimeCardTransaction(payDate.AddDays(-1), 5.0, empId, database);

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

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

            t.Execute();
            TimeCardTransaction tct =
                new TimeCardTransaction(
                    new DateTime(2005, 7, 31), 8.0, empId, database);

            tct.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(new DateTime(2005, 7, 31));

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }
Exemplo n.º 18
0
        public void AddServiceCharge()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(
                empId, "Bill", "Home", 15.25, database);

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

            Assert.IsNotNull(e);
            UnionAffiliation af = new UnionAffiliation();

            e.Affiliation = af;
            int memberId = 86; // Maxwell Smart

            database.AddUnionMember(memberId, e);
            ServiceChargeTransaction sct =
                new ServiceChargeTransaction(
                    memberId, new DateTime(2005, 8, 8), 12.95, database);

            sct.Execute();
            ServiceCharge sc =
                af.GetServiceCharge(new DateTime(2005, 8, 8));

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Amount, .001);
        }
Exemplo n.º 19
0
        public void TestTimeCardTransaction()
        {
            int empId = 31;
            var t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25, database);

            t.Execute();

            var today = DateTime.UtcNow;
            var tct   = new TimeCardTransaction(today, 8.0, empId, database);

            tct.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(today);

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }
Exemplo n.º 20
0
        public void TestChangeCommissionedTransaction()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();

            ChangeCommissionedTransaction cht = new ChangeCommissionedTransaction(empId, 2500, 3.2);

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

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is CommissionedClassification);
            CommissionedClassification hc = pc as CommissionedClassification;

            Assert.AreEqual(2500, hc.Salary);
            Assert.AreEqual(3.2, hc.CommissionRate);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is BiweeklySchedule);
        }
        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);
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
0
        public void TestAddHourlyEmployee()
        {
            int empId           = 2;
            AddHourlyEmployee t =
                new AddHourlyEmployee(empId, "Micah", "Home", 200.00, database);

            t.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.AreEqual("Micah", e.Name);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            Assert.AreEqual(200.00, hc.HourlyRate, .001);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is WeeklySchedule);

            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Exemplo n.º 24
0
        public void TestAddHourlyEmployee()
        {
            int empId           = 1;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 50.00, database);

            t.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.That("Kubing", Is.EqualTo(e.Name));

            PaymentClassification pc = e.Classification;

            Assert.That(pc is HourlyClassification, Is.True);

            HourlyClassification sc = pc as HourlyClassification;

            Assert.AreEqual(50.00, sc.HourlyRate, .001);

            PaymentSchedule ps = e.Schedule;

            Assert.That(ps is WeeklySchedule, Is.True);

            PaymentMethod pm = e.Method;

            Assert.That(pm is HoldMethod, Is.True);
        }
Exemplo n.º 25
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);
        }
        public void TestTimeCardTransaction()
        {
            int empId           = 5;
            var name            = "Łukasz";
            var hourlyRate      = 15.25;
            var date            = new DateTime(2005, 7, 31);
            var hours           = 8.0;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, name, "Home", hourlyRate);

            t.Execute();

            TimeCardTransaction tct = new TimeCardTransaction(date, hours, empId);

            tct.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            IPaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            TimeCard tc = hc.GetTimeCard(date);

            Assert.IsNotNull(tc);
            Assert.AreEqual(hours, tc.Hours);
        }
Exemplo n.º 27
0
        public void TestChangeCommissionTransaction()
        {
            int empId           = 5;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 15.25, database);

            t.Execute();

            ChangeCommissionedTransaction cct = new ChangeCommissionedTransaction(empId, 2000.00, 3.8, database);

            cct.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is CommissionedClassification);

            CommissionedClassification cc = pc as CommissionedClassification;

            Assert.AreEqual(2000.00, cc.Salary, 0.001);
            Assert.AreEqual(3.8, cc.CommissionRate, 0.001);

            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is BiweeklySchedule);
        }
Exemplo n.º 28
0
        public void TestAddServiceCharge()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 15.25, database);

            t.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            int memberId = 86;

            database.AddUnionMember(memberId, e);

            UnionAffiliation ua = new UnionAffiliation(memberId, 99.52);

            e.Affiliation = ua;

            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);
        }
Exemplo n.º 29
0
        public void TestTimeCardTransaction()
        {
            int empId           = 5;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Kubing", "Home", 15.25, database);

            t.Execute();

            var punchDay            = new DateTime(2005, 7, 31);
            TimeCardTransaction tct = new TimeCardTransaction(punchDay, 8.0, empId, database);

            tct.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is HourlyClassification);

            HourlyClassification hc = pc as HourlyClassification;
            var timeCards           = database.GetTimeCards(empId).ToList();
            var tc = timeCards.FirstOrDefault(x => x.Date == punchDay);

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }
Exemplo n.º 30
0
        public void PaySingleHourlyEmployeeTwoTimeCards()
        {
            int               empId      = 3;
            string            name       = "Marek";
            string            address    = "Home";
            double            hourlyRate = 15.25;
            int               hours1     = 2;
            int               hours2     = 5;
            AddHourlyEmployee t          = new AddHourlyEmployee(empId, name, address, hourlyRate);

            t.Execute();
            DateTime            payDate = new DateTime(2001, 11, 9); // piątek
            TimeCardTransaction tc1     = new TimeCardTransaction(payDate, hours1, empId);

            tc1.Execute();
            TimeCardTransaction tc2 = new TimeCardTransaction(payDate.AddDays(-1), hours2, empId);

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

            pt.Execute();
            var pc = pt.GetPayCheck(empId);

            ValidatePayCheck(pt, empId, payDate, (7) * hourlyRate);
        }
Exemplo n.º 31
0
 public void TimeCardTransaction()
 {
     int empId = 5;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2015, 10, 31), 8.0, empId);
     tct.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     PaymentClassification pc = e.Classification;
     Assert.IsTrue(pc is HourlyClassification);
     TimeCard tc = hc.GetTimeCard(new DateTime(2015, 10, 31));
     Assert.IsNotNull(tc);
     Assert.AreEqual(8.0, tc.Hours);
 }
Exemplo n.º 32
0
 public void TestAddHourlyEmployee()
 {
     int empId = 1;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bob", "Home", 24);
     t.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.AreEqual("Bob", e.Name);
     PaymentClassification pc = e.Classification;
     Assert.IsTrue(pc is HourlyClassification);
     HourlyClassification sc = pc as HourlyClassification;
     Assert.AreEqual(24, sc.HourlyRate, .001);
     PaymentSchedule ps = e.Schedule;
     Assert.IsTrue(ps is WeeklySchedule);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is HoldMethod);
 }
Exemplo n.º 33
0
 public void TimeCardTransaction()
 {
     int empId = 5;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2015, 10, 31), 8.0, empId);
     tct.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
 }