public void CanCreateSalaryEmployee() { IEmployeeFactory basicEmployeeFactory = new DepartmentEmployeeFactory(); var contract = new EmployeeBuilderContract() { YearlyRate = 120000, Type = EmployeeType.Salary }; var employee = basicEmployeeFactory.CreateEmployee(contract); Assert.IsTrue(employee.Type == EmployeeType.Salary); }
public void EmployeesDoHaveDepartment() { IEmployeeFactory basicEmployeeFactory = new DepartmentEmployeeFactory(); var contract = new EmployeeBuilderContract() { HourlyRate = 10, WeeklyHourAllotment = 40, Type = EmployeeType.Hourly }; var employee = basicEmployeeFactory.CreateEmployee(contract); Assert.IsNotNull(employee.Department); }
public void CanCreateContractEmployee() { IEmployeeFactory basicEmployeeFactory = new DepartmentEmployeeFactory(); var contract = new EmployeeBuilderContract() { HourlyRate = 10, WeeklyHourAllotment = 40, Type = EmployeeType.Contract }; var employee = basicEmployeeFactory.CreateEmployee(contract); Assert.IsTrue(employee.Type == EmployeeType.Contract); }
public void CanGetSalaryMonthlyPaycheck() { IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory(); var contract = new EmployeeBuilderContract() { YearlyRate = 120000, Type = EmployeeType.Salary }; IEmployee employee = basicEmployeeFactory.CreateEmployee(contract); Assert.IsTrue(employee.GetMonthlyPaycheck() == 120000m / 12); }
public void CanGetContractMonthlyPaycheck() { IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory(); var contract = new EmployeeBuilderContract() { HourlyRate = 10, WeeklyHourAllotment = 40, Type = EmployeeType.Contract }; IEmployee employee = basicEmployeeFactory.CreateEmployee(contract); Assert.IsTrue(employee.GetMonthlyPaycheck() == 10 * 40 * 4); }
public void CanOverrideFullName() { IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory(); var contract = new EmployeeBuilderContract() { YearlyRate = 120000, Type = EmployeeType.Salary }; IEmployee employee = basicEmployeeFactory.CreateEmployee(contract); employee.FirstName = "John"; employee.LastName = "Smith"; Assert.IsTrue(employee.GetFullName().Equals("Smith, John", StringComparison.InvariantCultureIgnoreCase)); }
public void DefaultFullNameWorks() { IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory(); var contract = new EmployeeBuilderContract() { HourlyRate = 10, WeeklyHourAllotment = 40, Type = EmployeeType.Hourly }; IEmployee employee = basicEmployeeFactory.CreateEmployee(contract); employee.FirstName = "John"; employee.LastName = "Smith"; Assert.IsTrue(employee.GetFullName().Equals("John Smith", StringComparison.InvariantCultureIgnoreCase)); }