public void TestAddHourlyEmployee() { int empId = 1; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bob", "Home", 100.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(100, sc.HourlyRate, 0.001); PaymentSchedule ps = e.Schedule; Assert.IsTrue(ps is WeeklySchedule); PaymentMethod pm = e.Method; Assert.IsTrue(pm is HoldMethod); }
public void TimeCardTransaction() { int empId = 1; 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); }
public void TestPaySingleHourlyEmployeeOvertimeOneTimeCard() { int empId = 1; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Билл", "Домашний адрес", 15.25); t.Execute(); DateTime payDate = new DateTime(2001, 11, 9); 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); }
public void PaySingleHourlyEmployeeOneTimeCard() { int empId = 1; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Билл", "Домашний адрес", 15.25); t.Execute(); DateTime payDate = new DateTime(2015, 12, 4); TimeCardTransaction tc = new TimeCardTransaction(payDate, 2.0, empId); tc.Execute(); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); ValidateHourlyPaycheck(pt, empId, payDate, 30.5); }
public void PayingSingleHourlyEmployeeNoTimeCards() { int empid = 1; AddHourlyEmployee t = new AddHourlyEmployee(empid, "Билл", "Адрес", 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); }
public void TestChangeUnionMember() { int empId = 1; 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); }
public void TestChangeAddressTransaction() { int empId = 1; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25); t.Execute(); ChangeAddressTransaction cnt = new ChangeAddressTransaction(empId, "Wall street"); cnt.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.IsNotNull(e); Assert.AreEqual("Wall street", e.Address); }
public void AddServiceCharge() { int empId = 1; 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(memberId, e); ServiceChargeTransaction sct = new ServiceChargeTransaction(memberId, new DateTime(2015, 11, 8), 10); sct.Execute(); ServiceCharge sc = af.GetServiceCharge(new DateTime(2015, 11, 8)); Assert.IsNotNull(sc); Assert.AreEqual(10, sc.Charge, .001); }