예제 #1
0
 public void TestAddHourlyEmployee()
 {
     int empId = 1;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bob", "Home", 12.00);
     t.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.AreEqual("Bob", e.Name);
     PaymentClassification pc = e.Classification;
     Assert.IsTrue(pc is HourlyClassification);
     HourlyClassification hc = pc as HourlyClassification;
     Assert.AreEqual(12.00, hc.HourlyRate, .001);
     PaymentSchedule ps = e.Schedule;
     Assert.IsTrue(ps is WeeklySchedule);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is HoldMethod);
 }
예제 #2
0
 public void TestAddServiceCharge()
 {
     int empId = 7;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     UnionAffiliation af = new UnionAffiliation();
     e.Affiliation = af;
     int memberId = 86;
     PayrollDatabase.AddUnionMember(86, e);
     ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2015, 11, 8), 12.95);
     sct.Execute();
     ServiceCharge sc = af.GerServiceCharge(new DateTime(2015, 11, 8));
     Assert.IsNotNull(sc);
     Assert.AreEqual(12.95, sc.Charge, .001);
 }
예제 #3
0
 public void TestTimeCardTransaction()
 {
     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);
     HourlyClassification hc = pc as HourlyClassification;
     TimeCard tc = hc.GetTimeCard(new DateTime(2015, 10, 31));
     Assert.IsNotNull(tc);
     Assert.AreEqual(8.0, tc.Hours);
 }
예제 #4
0
 public void TestChangeUnionMember()
 {
     int empId = 13;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 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.Charge, .001);
     Employee member = PayrollDatabase.GetUnionMember(memberId);
     Assert.IsNotNull(member);
     Assert.AreEqual(e, member);
 }
예제 #5
0
 public void TestChangeNameTransaction()
 {
     int empId = 2;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     ChangeNameTransaction cnt = new ChangeNameTransaction(empId, "Bob");
     cnt.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     Assert.AreEqual("Bob", e.Name);
 }
예제 #6
0
 public void TestChangeAddressTransaction()
 {
     int empId = 2;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bob", "Address", 15.25);
     t.Execute();
     ChangeAddressTransaction cat = new ChangeAddressTransaction(empId, "Home");
     cat.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     Assert.AreEqual("Home", e.Address);
 }