Esempio n. 1
0
        public void AddServiceCharge()
        {
            int empId = 2;
            AddHourlyEmployee hourlyEmployee = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            hourlyEmployee.Execute();

            Employee         employee = PayRollDatabase.GetEmloyee(empId);
            UnionAffiliation af       = new UnionAffiliation();

            employee.Affiliation = af;
            int memberId = 86;

            PayRollDatabase.AddUnionMember(memberId, employee);
            ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2005, 8, 8), 12.95);

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

            Assert.IsNotNull(sc);
            Assert.AreEqual(12.95, sc.Amount, .001);
        }
        public void TestTimeCardTransaction()
        {
            int empId           = 5;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

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

            Employee e = PayrollDatabase.GetEmloyee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

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

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

            Assert.IsNotNull(tc);
            Assert.AreEqual(8.0, tc.Hours);
        }