public void GetAllAssignmentsByCompanyIdShouldReturnOkObjectResult(int companyId) { _internshipAssignmentMock.Setup(_ia => _ia.GetAllInternshipAssignmentsByCompanyId(It.IsAny <int>())) .Returns(GetAllAssignmentListByCompanyId); var assignmentModel = new AssignmentsModel { CompanyId = companyId, Id = 1 }; var assignments = _assignmentsController.GetAllInternshipAssignmentsByCompanyId(assignmentModel); Assert.NotNull(assignments); Assert.AreEqual(assignments.GetType(), typeof(OkObjectResult)); }
public void GetAllAssignmentsByCompanyIdShouldReturnAListOfAssignmentReturnModels(int companyId) { _internshipAssignmentMock.Setup(_ia => _ia.GetAllInternshipAssignmentsByCompanyId(It.IsAny <int>())) .Returns(GetAllAssignmentListByCompanyId); var assignmentModel = new AssignmentsModel { CompanyId = companyId, Id = 1 }; var assignments = _assignmentsController.GetAllInternshipAssignmentsByCompanyId(assignmentModel); Assert.NotNull(assignments); var result = assignments as OkObjectResult; Assert.IsInstanceOf <IEnumerable <ReturnAssignmentModel> >(result.Value); }
public IActionResult GetAllInternshipAssignmentsByCompanyId([FromBody] AssignmentsModel model) { var assignments = _internshipAssignments.GetAllInternshipAssignmentsByCompanyId(model.CompanyId) .Select(mapAssignmentModel); return Ok(assignments); }