public void ValidateOverloadNormalTestCase() { bool expected = true; bool?actual = null; string firstName = "Jody"; string lastName = "Markic"; DateTime dob = DateTime.Parse("1993-08-24"); string sin = "123456782"; Seasons season = Seasons.SUMMER; double piecePay = 2.50; actual = SeasonalEmployee.validate(firstName, lastName, dob, sin, season, piecePay); Assert.AreEqual(expected, actual); }
public void ValidateNormalTestCase() { bool expected = true; bool?actual = null; SeasonalEmployee seEmployee = new SeasonalEmployee(); seEmployee.FirstName = "Jody"; seEmployee.LastName = "Markic"; seEmployee.DOB = DateTime.Parse("1993-08-24"); seEmployee.SIN = "123456782"; seEmployee.Season = Seasons.SUMMER; seEmployee.PiecePay = 2.50; actual = SeasonalEmployee.validate(seEmployee); Assert.AreEqual(expected, actual); }
/// <summary> /// \brief <b>Description</b> /// \details This function adds an employee to the collection /// </summary> /// <param name="emp">This is the employee that will be added</param> /// <returns>True if the employee was added successfully</returns> public bool addEmployee(Employee emp) { bool retCode = false; switch (getType(emp)) { case EmployeeType.FT: retCode = FulltimeEmployee.validate((FulltimeEmployee)emp); break; case EmployeeType.PT: retCode = ParttimeEmployee.validate((ParttimeEmployee)emp); break; case EmployeeType.CT: retCode = ContractEmployee.validate((ContractEmployee)emp); break; case EmployeeType.SN: retCode = SeasonalEmployee.validate((SeasonalEmployee)emp); break; default: break; } if (retCode) { if (EmployeeList.ContainsKey(emp.SIN)) { retCode = false; } else { EmployeeList.Add(emp.SIN, emp); Logging.Log("[Container.AddEmployee] Employee Added - " + emp.LastName + ", " + emp.FirstName + " (" + emp.SIN + ") - VALID"); } } return(retCode); }
/// <summary> /// \brief <b>Description</b> /// \details This function adds an employee to the collection given all the values for a Seasonal employee /// </summary> /// <param name="firstName">first name of the employee</param> /// <param name="lastName">last name of the employee</param> /// <param name="dob">Date of birth of the employee</param> /// <param name="sin">Social Insurance Number of the employee</param> /// <param name="season">season the employee works in</param> /// <param name="piecePay">piecePay of the employee</param> /// <returns>True if the employee was added successfully</returns> public bool addEmployee(string fName, string lName, DateTime dob, string sin, Seasons season, double payAmount) { bool retCode = false; Employee emp = null; if (retCode = SeasonalEmployee.validate(fName, lName, dob, sin, season, payAmount)) { emp = new SeasonalEmployee(fName, lName, dob, sin, season, payAmount); if (EmployeeList.ContainsKey(emp.SIN)) { retCode = false; } else { EmployeeList.Add(emp.SIN, emp); Logging.Log("[Container.AddEmployee] Employee Added - " + emp.LastName + ", " + emp.FirstName + " (" + emp.SIN + ") - VALID"); } } return(retCode); }