예제 #1
0
        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));
        }
예제 #2
0
        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);
        }
예제 #3
0
 public IActionResult GetAllInternshipAssignmentsByCompanyId([FromBody] AssignmentsModel model)
 {
     var assignments = _internshipAssignments.GetAllInternshipAssignmentsByCompanyId(model.CompanyId)
         .Select(mapAssignmentModel);
     return Ok(assignments);
 }