Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public async Task PayingSingleHorlyEmployeeNoTimeCards()
        {
            int empId           = 12;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
            await t.ExecuteAsync();

            DateTime          payDate = new DateTime(2001, 11, 9);
            PaydayTransaction pt      = new PaydayTransaction(payDate);
            await pt.ExecuteAsync();

            ValidatePaycheck(pt, empId, payDate, 0.0);
        }
Exemplo n.º 3
0
        public async Task ChangeNameTransaction()
        {
            int empId           = 5;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
            await t.ExecuteAsync();

            ChangeNameTransaction cnt = new ChangeNameTransaction(empId, "Bob");
            await cnt.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.NotNull(e);
            Assert.Equal("Bob", e.Name);
        }
Exemplo n.º 4
0
        public async Task TimeCardTransaction()
        {
            int empId           = 3;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
            await t.ExecuteAsync();

            TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2005, 7, 31), 8.0, empId);
            await tct.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.NotNull(e);

            Classification.PaymentClassification pc = e.Classification;
            Assert.True(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

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

            Assert.NotNull(tc);
            Assert.Equal(8.0, tc.Hours);
        }
Exemplo n.º 5
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);
        }