public void When_Occupation_Area_3_Salary_Weight_3_WorkYears_3_Validate_Profit_Calculation() { string id = "1234"; string occupationArea = "Serviços Gerais"; string name = "Joana"; string position = "Eletricista"; string admissionDate = "2017-10-20"; string salary = "R$ 6000,00"; Employee employee = new Employee(id, occupationArea, name, position, admissionDate, salary); int occupationAreaWeight = 3; int salaryWeight = 3; int workYearsWeight = 3; EmployeeParticipation employeeParticipation = new EmployeeParticipation( employee, occupationAreaWeight, salaryWeight, workYearsWeight ); double convertedEmployeeParticipation = double.Parse(employeeParticipation.ValorParticipacao.Replace("R$ ", "")); convertedEmployeeParticipation.Should().Be(144000); }
public void When_Occupation_Area_5_Salary_Weight_5_WorkYears_5_Validate_Profit_Calculation() { string id = "1234"; string occupationArea = "Diretoria"; string name = "Joao"; string position = "Diretor de Finanças"; string admissionDate = "2010-10-20"; string salary = "R$ 12000,00"; Employee employee = new Employee(id, occupationArea, name, position, admissionDate, salary); int occupationAreaWeight = 5; int salaryWeight = 5; int workYearsWeight = 5; EmployeeParticipation employeeParticipation = new EmployeeParticipation( employee, occupationAreaWeight, salaryWeight, workYearsWeight ); double convertedEmployeeParticipation = double.Parse(employeeParticipation.ValorParticipacao.Replace("R$ ", "")); convertedEmployeeParticipation.Should().Be(288000); }
public void When_Occupation_Area_2_Salary_Weight_2_WorkYears_2_Validate_Profit_Calculation() { string id = "1234"; string occupationArea = "Tecnologia"; string name = "Joao"; string position = "Desenvolvedor"; string admissionDate = "2019-10-20"; string salary = "R$ 3.500,00"; Employee employee = new Employee(id, occupationArea, name, position, admissionDate, salary); int occupationAreaWeight = 2; int salaryWeight = 2; int workYearsWeight = 2; EmployeeParticipation employeeParticipation = new EmployeeParticipation( employee, occupationAreaWeight, salaryWeight, workYearsWeight ); double convertedEmployeeParticipation = double.Parse(employeeParticipation.ValorParticipacao.Replace("R$ ", "")); convertedEmployeeParticipation.Should().Be(84000); }
public Profit GetProfit(double expectedProfit) { _logger.LogInformation("Service: GetProfit - Start"); List <Employee> employeeList = _employeeRepository.GetEmployees(); List <OccupationAreaWeight> occupationAreaWeightList = OccupationAreService.GetWeightList(); List <SalaryWeight> salaryWeightList = SalaryWeightService .GetWeightList() .OrderBy(x => x.Id) .ToList(); List <WorkYearsWeight> workYearList = WorkYearsWeightService.GetWeightList(); List <EmployeeParticipation> participationList = new List <EmployeeParticipation>(); foreach (Employee employee in employeeList) { DateTime employeeAdmission = DateTime.Parse(employee.AdmissionDate); string actuationArea = employee.Area; double convertedSalary = double.Parse(employee.Salary.Replace("R$ ", "")); double convertedMinimumSalary = double.Parse(MinimumSalary); int occupationAreaWeight = occupationAreaWeightList.Find(x => x.OccupationArea.Equals(actuationArea)).Weight; int salaryWeight = salaryWeightList .Find(x => x .IsSalaryIsInThisWeight(convertedMinimumSalary, convertedSalary, employee.Position) .Equals(true) ) .Weight; int workYearsWeight = workYearList .Find(x => x.IsYearIsInThisWeight(employeeAdmission.Year) .Equals(true)) .Weight; EmployeeParticipation employeeParticipation = new EmployeeParticipation( employee, occupationAreaWeight, salaryWeight, workYearsWeight ); participationList.Add(employeeParticipation); } Profit profit = new Profit(participationList, expectedProfit); _logger.LogInformation("Service: GetProfit - Finish - Generated Profit: " + profit.ToString()); return(profit); }