public async Task ShouldFetchAllApplicantInformation()
        {
            var result = await applicantService.GetAllApplicants();

            Assert.IsNotNull(result);
            Assert.AreEqual(ResultCode.SUCCESS, result.ResponseCode);
        }
示例#2
0
        public async Task <IActionResult> GetAll(int pageNumber = 1, int perPage = 6)
        {
            if (pageNumber <= 0)
            {
                _logger.LogInformation($"Bad request on get for all applicants by page number {pageNumber}.");

                return(BadRequest(new { message = $"Page number {pageNumber} is invalid " }));
            }
            var applicantService = new ApplicantService(_unitOfWork);
            var applicants       = await applicantService.GetAllApplicants(pageNumber, perPage);

            _logger.LogInformation($"Get request for all applicants.");

            return(applicants.Count == 0 ? Ok(new { message = "No applicants in the database" }) : Ok(applicants));
        }