public void TestPaySingleHourlyEmployeeTwoTimeCards() { int empId = 2; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m); t.Execute(); DateTime payDate = new DateTime(2020, 2, 7); TimeCardTransaction tct = new TimeCardTransaction(payDate, 2.0, empId); tct.Execute(); TimeCardTransaction tct2 = new TimeCardTransaction(payDate.AddDays(-5), 5.0, empId); tct2.Execute(); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); ValidatePaycheck(pt, empId, payDate, 7m * 15.25m); }
public void TestPaySingleHourlyEmployeeOnWrongDate() { int empId = 2; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m); t.Execute(); DateTime payDate = new DateTime(2020, 2, 6); TimeCardTransaction tct = new TimeCardTransaction(payDate, 2.0, empId); tct.Execute(); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); Paycheck pc = pt.GetPaycheck(empId); Assert.That(pc, Is.Null); }
public void TestHourlyUnionMemberDues() { int empId = 1; var t = new AddHourlyEmployee(empId, "Bob", "Home", 12.0m); t.Execute(); int memberId = 7734; var cmt = new ChangeMemberTransaction(empId, memberId, 9.42m); cmt.Execute(); DateTime payDate = new DateTime(2020, 01, 24); var pt = new PaydayTransaction(payDate); pt.Execute(); //1 Friday var unionDues = 9.42m; ValidatePaycheck(pt, empId, payDate, 0m, unionDues); }
public void TestPaySingleHourlyEmployeeWithTimeCardSpanningTwoPayPeriods() { int empId = 2; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "home", 15.25m); t.Execute(); DateTime payDate = new DateTime(2020, 2, 7); DateTime dateInPreviousPeriod = payDate.AddDays(-7); TimeCardTransaction tct = new TimeCardTransaction(payDate, 2.0, empId); tct.Execute(); TimeCardTransaction tct2 = new TimeCardTransaction(dateInPreviousPeriod, 10.0, empId); tct2.Execute(); PaydayTransaction pt = new PaydayTransaction(payDate); pt.Execute(); ValidatePaycheck(pt, empId, payDate, 30.5m); }
public void TestAddHourlyEmployee() { int empId = 2; AddEmployeeTransaction t = new AddHourlyEmployee(empId, "Bob", "Home", 12.75m); t.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.That(e.Name, Is.EqualTo("Bob")); PaymentClassification pc = e.Classification; Assert.That(pc is HourlyClassification, Is.True); HourlyClassification hc = pc as HourlyClassification; Assert.That(hc.HourlyRate, Is.EqualTo(12.75m)); PaymentSchedule ps = e.Schedule; Assert.That(ps is WeeklySchedule, Is.True); PaymentMethod pm = e.Method; Assert.That(pm is HoldMethod, Is.True); }
public void TestTimeCardTransaction() { int empId = 5; AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25m); t.Execute(); TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2020, 02, 02), 8.0, empId); tct.Execute(); Employee e = PayrollDatabase.GetEmployee(empId); Assert.That(e, Is.Not.Null); PaymentClassification pc = e.Classification; Assert.That(pc is HourlyClassification, Is.True); HourlyClassification hc = pc as HourlyClassification; TimeCard tc = hc.GetTimeCard(new DateTime(2020, 02, 02)); Assert.That(tc, Is.Not.Null); Assert.That(tc.Hours, Is.EqualTo(8.0)); }