/// <summary> /// Calls service to get the list of employees under the selected employer from grid /// </summary> /// <param name="employerId"></param> /// <returns></returns> public IActionResult Employee(int employerId) { var model = new List <Employee>(); model = employerService.GetAllEmployeesForEmployer(employerId); return(PartialView(model)); }
public void WhenServiceReturnsUnexpectedResponse_GetAllEmployeesForEmployer_ReturnsEmptyListOfEmployees() { //Arrange var httpClient = CreateHttpClient(HttpStatusCode.Unauthorized, new List <Employee>()); employerService = new EmployerService(httpClient); // ACT var actualResult = employerService.GetAllEmployeesForEmployer(1009); //Assert Assert.AreEqual(0, actualResult.Count); }
public void WhenInValidInputProvided_GetAllEmployeesForEmployer_ReturnsEmptyListOfEmployees() { //Arrange var httpClient = CreateHttpClient(HttpStatusCode.BadRequest, new List <Employee>()); employerService = new EmployerService(httpClient); // ACT var actualResult = employerService.GetAllEmployeesForEmployer(-1); //Assert Assert.AreEqual(0, actualResult.Count); }
public void WhenValidInputProvided_GetAllEmployeesForEmployer_ReturnsValidListOfEmployees() { //Arrange var employees = new List <Employee> { new Employee { FirstName = "Test" } }; var httpClient = CreateHttpClient(HttpStatusCode.OK, employees); employerService = new EmployerService(httpClient); // ACT var actualResult = employerService.GetAllEmployeesForEmployer(10001); //Assert Assert.AreEqual(1, actualResult.Count); }