示例#1
0
 public void ChangeHoldMethod()
 {
     int empid = 12;
     AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "home", 25);
     t.Execute();
     ChangeHoldTransaction cht = new ChangeHoldTransaction(empid);
     cht.Execute();
     Employee e = PayrollDatabase.GetEmployee(empid);
     Assert.IsNotNull(e);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is HoldMethod);
 }
示例#2
0
 public void ChangeMailMethod()
 {
     int empid = 11;
     AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "home", 25);
     t.Execute();
     ChangeMailTransaction cmt = new ChangeMailTransaction(empid, "*****@*****.**");
     cmt.Execute();
     Employee e = PayrollDatabase.GetEmployee(empid);
     Assert.IsNotNull(e);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is MailMethod);
     MailMethod mm = pm as MailMethod;
     Assert.AreEqual("*****@*****.**", mm.MailAddress);
 }
示例#3
0
 public void PayingSingleHourlyEmployeeNoTimeCards()
 {
     int empid = 16;
     AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Address", 15.25);
     t.Execute();
     DateTime payDate = new DateTime(2015, 11, 27);
     PaydayTransaction pt = new PaydayTransaction(payDate);
     pt.Execute();
     Paycheck pc = pt.GetPaycheck(empid);
     Assert.IsNotNull(pc);
     Assert.AreEqual(payDate, pc.PayDate);
     Assert.AreEqual(0.0, pc.GrossPay);
     Assert.AreEqual("Hold", pc.GetField("Disposition"));
     Assert.AreEqual(0.0, pc.Deductions, .001);
     Assert.AreEqual(0.0, pc.NetPay, .001);
 }
示例#4
0
 public void ChangeUnionMember()
 {
     int empid = 13;
     AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "office", 256.1);
     t.Execute();
     int memberId = 7743;
     ChangeMemberTransaction cmt = new ChangeMemberTransaction(empid, memberId, 99.42);
     cmt.Execute();
     Employee e = PayrollDatabase.GetEmployee(empid);
     Assert.IsNotNull(e);
     Affilation affiliation = e.Affilation;
     Assert.IsNotNull(affiliation);
     Assert.IsTrue(affiliation is UnionAffilation);
     UnionAffilation uf = affiliation as UnionAffilation;
     Assert.AreEqual(99.42, uf.Charge, .001);
     Employee member = PayrollDatabase.GetUnionMember(memberId);
     Assert.IsNotNull(member);
     Assert.AreEqual(e, member);
 }
示例#5
0
 public void PayingSingleHourlyEmployeeOvertimeTimeCards()
 {
     int empid = 18;
     AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 15.25);
     t.Execute();
     DateTime payDate = new DateTime(2015, 11, 27);
     TimeCardTransaction tc = new TimeCardTransaction(payDate, 9.0, empid);
     tc.Execute();
     PaydayTransaction pt = new PaydayTransaction(payDate);
     pt.Execute();
     ValidateHourlyPaycheck(pt, empid, payDate, (8 + 1.5) * 15.25);
 }
示例#6
0
 public void TestTimeCardTransaction()
 {
     int empId = 5;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 2000);
     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);
 }
示例#7
0
 public void TestChangeNameTransaction()
 {
     int empId = 6;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 2000);
     t.Execute();
     ChangeNameTransaction cnt = new ChangeNameTransaction(empId, "Bob");
     cnt.Execute();
     Employee e = PayrollDatabase.GetEmployee(empId);
     Assert.IsNotNull(e);
     Assert.AreEqual("Bob", e.Name);
 }
示例#8
0
 public void TestAddHourlyEmployee()
 {
     int empId = 2;
     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.Rate, .001);
     PaymentSchedule ps = e.Schedule;
     Assert.IsTrue(ps is HourlySchedule);
     PaymentMethod pm = e.Method;
     Assert.IsTrue(pm is HoldMethod);
 }
示例#9
0
 public void PaySingleHourlyEmployeeOnWrongDate()
 {
     int empid = 19;
     AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bill", "Home", 15.25);
     t.Execute();
     DateTime payDate = new DateTime(2015, 12, 3);
     TimeCardTransaction tc = new TimeCardTransaction(payDate, 9.0, empid);
     tc.Execute();
     PaydayTransaction pt = new PaydayTransaction(payDate);
     pt.Execute();
     Paycheck pc = pt.GetPaycheck(empid);
     Assert.IsNull(pc);
 }
示例#10
0
 public void PayingSingleHourlyEmployeeTwoTimeCards()
 {
     int empId = 20;
     AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);
     t.Execute();
     DateTime payDate = new DateTime(2015, 12, 4);
     TimeCardTransaction tc = new TimeCardTransaction(payDate, 2.0, empId);
     tc.Execute();
     TimeCardTransaction tc2 = new TimeCardTransaction(payDate.AddDays(-1), 5.0, empId);
     tc2.Execute();
     PaydayTransaction pt = new PaydayTransaction(payDate);
     pt.Execute();
     ValidateHourlyPaycheck(pt, empId, payDate, 7 * 15.25);
 }