コード例 #1
0
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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
ファイル: PayrollTest_BAV.cs プロジェクト: andrewbav/Payroll
 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);
 }