public void TestGetEmployeeById() { MASGlobalEmployeesManager mng = new MASGlobalEmployeesManager(apiEndpointTest); var employee = mng.GetEmployeeById(1); Assert.IsNotNull(employee); Assert.IsTrue(employee.id == 1); }
public void TestGetEmployees() { MASGlobalEmployeesManager mng = new MASGlobalEmployeesManager(apiEndpointTest); var employees = mng.GetEmployees(); Assert.IsNotNull(employees); Assert.IsTrue(employees.Count > 0); }
// GET api/<controller> public List <EmployeeDTO> Get() { var masGlobalApiEndpoint = ConfigurationManager.AppSettings["MASGlobalApiEndpoint"]; List <EmployeeDTO> _employees = null; try { MASGlobalEmployeesManager manager = new MASGlobalEmployeesManager(masGlobalApiEndpoint); _employees = manager.GetEmployees(); } catch (Exception ex) { throw new HttpResponseException(HttpStatusCode.InternalServerError); } return(_employees); }
// GET api/<controller>/5 public EmployeeDTO Get(int id) { var masGlobalApiEndpoint = ConfigurationManager.AppSettings["MASGlobalApiEndpoint"]; EmployeeDTO _theEmployee = null; try { MASGlobalEmployeesManager manager = new MASGlobalEmployeesManager(masGlobalApiEndpoint); _theEmployee = manager.GetEmployeeById(id); } catch (EmployeeNotFoundException notFoundEx) { throw new HttpResponseException(HttpStatusCode.NotFound); } catch (Exception ex) { throw new HttpResponseException(HttpStatusCode.InternalServerError); } return(_theEmployee); }