コード例 #1
0
        public async Task GetAllJobOffersAsync_ReturnsJobOffers_WhenBothAccountAndRecruiterExists()
        {
            //Arrange
            _accountRepositoryMock.Setup(mock => mock.GetByIdAsync(It.IsAny <string>())).ReturnsAsync(new Account());

            _recruiterRepositoryMock.Setup(mock => mock.CheckEntityExistsAsync(It.IsAny <string>())).ReturnsAsync(true);

            var jobOfferList = new List <JobOffer>
            {
                new JobOffer(), new JobOffer()
            };

            _jobOfferRepositoryMock.Setup(mock => mock.GetAllJobOffersByRecruiter(It.IsAny <string>())).ReturnsAsync(jobOfferList);

            //Act
            var result = await _service.GetAllJobOffersCreatedByAccountAsync(It.IsAny <string>());

            //Assert
            _accountRepositoryMock.VerifyAll();
            _recruiterRepositoryMock.VerifyAll();

            Assert.IsTrue(result.ToList().Count == 2);
            Assert.IsTrue(result.ToList().All(item => item.AlreadyApplied == false));
        }
コード例 #2
0
 public async Task <IEnumerable <JobOfferListDto> > GetJobOffers()
 {
     return(await _recruiterService.GetAllJobOffersCreatedByAccountAsync(HttpContext.User.Claims.FirstOrDefault(c => c.Type == "jta").Value));
 }