Пример #1
0
 public void SalesReceiptTransaction()
 {
     int empId = 8;
     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);
 }
Пример #2
0
 public void AddServiceCharge()
 {
     int empId = 9;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     UnionAffiliation  af = new UnionAffiliation();
     e.Affiliatiion = af;
     int memberId = 86;
     PayrollDatabase.AddUnionMember(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);
 }
Пример #3
0
 public void TestChangeNameTransaction()
 {
     int empId = 10;
     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);
 }
Пример #4
0
 public void TestAddHourlyEmployee()
 {
     int empId = 4;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bob", "Home", 132.00);
     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(132, sc.HourlyRate, 0.001);
     PaymentSchedule ps = e.Schedule;
     Assert.IsTrue(ps is WeeklySchedule);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is HoldMethod);
 }