public async Task <Models.Paycheck> execute(Guid employeeId)
        {
            Employee employee = await _showEmployeeService.execute(employeeId);

            Models.Paycheck paycheck = new Models.Paycheck();

            paycheck.Period      = System.DateTime.Now.AddMonths(-1);
            paycheck.GrossSalary = employee.grossWage;

            List <Models.PaycheckEntry> remunerations = _buildPaycheckEntriesRemunarationService.execute(employee);

            foreach (Models.PaycheckEntry entry in remunerations)
            {
                if (entry.Amount > 0)
                {
                    paycheck.Entries.Add(entry);
                }
            }

            List <Models.PaycheckEntry> discounts = _buildPaycheckEntriesDiscountService.execute(employee);

            foreach (Models.PaycheckEntry entry in discounts)
            {
                if (entry.Amount > 0)
                {
                    paycheck.Entries.Add(entry);
                }
            }

            return(paycheck);
        }
        public async Task TestGeyEmployeeByID()
        {
            Employee employeeData = new Employee();

            employeeData.name          = "John";
            employeeData.lastName      = "Doe";
            employeeData.document      = "124578";
            employeeData.grossWage     = 5000;
            employeeData.admissionDate = new System.DateTime(2019, 11, 06);
            employeeData.hasHealthPlan = true;
            employeeData.hasDentalPlan = true;
            employeeData.hasTransportationVouchersDiscount = true;

            Employee createdEmployee = await _createService.execute(employeeData);

            Employee foundEmployee = await _showService.execute(createdEmployee.Id);

            Assert.AreEqual(
                createdEmployee.Id,
                foundEmployee.Id
                );
        }
Example #3
0
 public async Task <ActionResult <Employee> > GetByID(
     [FromServices] ShowEmployeeService service,
     Guid id)
 {
     return(await service.execute(id));
 }