Пример #1
0
        public void AddServiceCharge()
        {
            int empId = SetupHourlyEmployee();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.NotNull(e);

            const int memberId = 86; // Maxwell Smart
            var       af       = new UnionAffiliation(memberId, 12.95);

            e.Affiliation = af;
            PayrollDatabase.AddUnionMember(memberId, e);

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

            sct.Execute();

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

            Assert.NotNull(sc);
            Assert.Equal(12.95, sc.Amount);
        }
Пример #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);
        }
Пример #3
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);
        }
Пример #4
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);
        }
        public void TestAddServiceCharge()
        {
            #region Arrange
            int employeeId          = 9;
            AddSalariedEmployee asd = new AddSalariedEmployee(employeeId, "user", "home", 1000.0);
            asd.Execute();
            Employee e = PayrollRepository.GetEmployee(employeeId);
            e.Should().NotBeNull();

            UnionAffiliation af = new UnionAffiliation();
            e.Affiliation = af;
            int memberId = 886;
            PayrollRepository.AddUnionMember(memberId, e);

            ServiceChargeTransaction sct = new ServiceChargeTransaction(
                memberId, new DateTime(2019, 10, 10), 10.0);
            #endregion

            #region Action
            sct.Execute();
            #endregion

            #region Assert
            ServiceCharge sc = af.GetServiceCharge(new DateTime(2019, 10, 10));
            sc.Should().NotBeNull();
            sc.Date.Should().Be(new DateTime(2019, 10, 10));
            sc.Amount.Should().Be(10.0);
            #endregion
        }
Пример #6
0
        public void AddServiceCharge()
        {
            int empId = 2;

            app.ExexcuteTransaction("addHourlyEmployee", RequestFactory.rf.MakeHourlyEmployeeRequest(empId, "Bob", "Home", 50));

            Employee e = PayrollDb.GetEmployee(empId);

            Assert.IsNotNull(e);

            UnionAffiliation af = new UnionAffiliation(50, 100.50);

            e.Affiliation = af;

            int memeberId = 86;

            PayrollDb.AddUnionMember(memeberId, e);

            app.ExexcuteTransaction("addServiceCharge", RequestFactory.rf.MakeServiceChargeRequest(memeberId, new DateTime(2005, 8, 8), 12.95));

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

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Amount, .001);
        }
Пример #7
0
        public void AddserviceCharge()
        {
            int empid           = 8;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 23.41);

            t.Execute();
            Employee e = PayrollDatabase.GetEmployee_Static(empid);

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

            e.Affiliation = af;
            int memberId = 86;

            PayrollDatabase.AddUnionMember_Static(memberId, e);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2015, 11, 8), 12.95);

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

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Charge, .001);
        }
Пример #8
0
        public async Task AddServiceCharge()
        {
            int empId           = 4;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
            await t.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

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

            e.Affiliation = af;
            int memberId = 86; // Maxwell Smart
            await PayrollDatabase.AddUnionMemberAsync(memberId, e);

            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2005, 8, 8), 12.95);
            await sct.ExecuteAsync();

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

            Assert.NotNull(sc);
            Assert.Equal(12.95, sc.Amount);
        }
Пример #9
0
        public void TestAddServiceCharge()
        {
            const int empId = 7;
            var       t     = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

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

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

            e.Affiliation = af;
            const int memberId = 86;

            PayrollDatabase.AddUnionMember(memberId, e);
            var sct = new ServiceChargeTransaction(memberId, new DateTime(2020, 8, 8), 12.95);

            sct.Execute();
            var sc = af.GetServiceCharge(new DateTime(2020, 8, 8));

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Amount, 0.001);
        }
Пример #10
0
        public void ExecuteTest()
        {
            int    empId     = 15;
            int    memberId  = 86;
            double unionDues = 90.8;

            double   chargeAmount = 12;
            DateTime chargeDate   = new DateTime(2014, 6, 7);

            //增加并获取雇员
            AddCommissionedEmployee addComEmp = new AddCommissionedEmployee(empId, "Muma", "shanghai", 12.3, 1.56, database);

            addComEmp.Execute();
            Employee emp = database.GetEmployee(empId);

            Assert.IsNotNull(emp);

            //设置并保存公会会员
            Affiliation unionAffiliation = new UnionAffiliation(memberId, unionDues);

            emp.Affiliation = unionAffiliation;
            database.AddUnionMember(memberId, emp);

            //将会费信息添加到会员上
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, chargeAmount, chargeDate, database);

            sct.Execute();

            //检查会费
            UnionAffiliation ua = emp.Affiliation as UnionAffiliation;

            Assert.IsNotNull(ua);
            ServiceCharge sc = ua.GetServiceCharge(chargeDate);

            Assert.IsNotNull(sc);
            Assert.AreEqual(sc.Amount, chargeAmount, 0.001);
        }