public async Task GetJobOffersAsync_ReturnsAListWithJobOffersIndicatingWhichOneAreAlreadyApplied()
        {
            //Arrange

            var jobOffer1 = new JobOffer()
            {
                Id = Guid.NewGuid().ToString()
            };
            var jobOffer2 = new JobOffer()
            {
                Id = Guid.NewGuid().ToString()
            };

            var cSharp = new Skill()
            {
                Id = Guid.NewGuid().ToString(), Name = "C#"
            };

            jobOffer1.AddSkillRequired(new SkillRequired(cSharp, 1, true));

            var jobOffers = new List <JobOffer>()
            {
                jobOffer1, jobOffer2
            };

            var person = new Person()
            {
                Id = Guid.NewGuid().ToString(), IdentityCard = "123", FirstName = "Pepe", LastName = "Lopez"
            };

            person.SetAbility(new Ability(cSharp, 3));

            jobOffer1.AddJobApplicationOffered(person);

            person.ApplyToJobOffer(jobOffers.First());

            _jobOfferRepositoryMock.Setup(mock => mock.GetAllPublishedJobOffersAsync()).ReturnsAsync(jobOffers);
            _personRepositoryMock.Setup(mock => mock.GetByIdAsync(It.IsAny <string>())).ReturnsAsync(person);


            //Act
            var result = await _service.GetJobOffersAsync(person.Id);

            //Assert
            Assert.IsTrue(result.Single(r => r.AlreadyApplied).JobOffer == jobOffer1, "JobOffers are not including the application that the person already did");
        }
Esempio n. 2
0
 public async Task <IEnumerable <JobOfferListDto> > Get(string accountId)
 {
     return(await _jobOfferService.GetJobOffersAsync(accountId));
 }
 public async Task <IEnumerable <JobOffer> > Get()
 {
     return(await _jobOfferService.GetJobOffersAsync());
 }