public async Task TestCreateEmployee()
        {
            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);

            Assert.NotNull(createdEmployee.Id);
        }
Exemple #2
0
 public async Task <ActionResult <Employee> > Create(
     [FromServices] CreateEmployeeService service,
     [FromBody] Employee model)
 {
     if (ModelState.IsValid)
     {
         return(await service.execute(model));
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }