예제 #1
0
        public async Task UnassignCandidateTest()
        {
            var vacancy = new Vacancy()
            {
                Id = 18,

                Status = 1,

                HRM = 2
            };

            Candidate candidate1 = new Candidate()
            {
                Id = 22,

                FirstNameEng = "David",

                LastNameEng = "Fraller",

                FirstNameRus = "Давид",

                LastNameRus = "Фраллер",

                Status = 1
            };

            Candidate candidate2 = new Candidate()
            {
                Id = 2,

                FirstNameEng = "Victor",

                LastNameEng = "Toll",

                FirstNameRus = "Виктор",

                LastNameRus = "Толл",

                Status = 3
            };

            vacancy.Candidates.Add(candidate1);

            vacancy.Candidates.Add(candidate2);

            mockCandidateRepository.Setup(x => x.Read(It.IsAny <int>())).Returns(candidate1);

            mockVacancyRepository.Setup(x => x.Read(It.IsAny <int>())).Returns(vacancy);

            var candidateRepository = mockCandidateRepository.Object;

            var unitOfWork = mockUnitOfWork.Object;

            var candidateService = mockCandidateService.Object;

            var techSkillRepository = mockTechSkillRepository.Object;

            var vacancyRepository = mockVacancyRepository.Object;

            var eventService = mockEventService.Object;

            var vacancyService = new VacancyService(unitOfWork, vacancyRepository, candidateRepository, techSkillRepository,
                                                    candidateService, eventService);

            var result = await vacancyService.UnassignCandidate(vacancy.Id, candidate1.Id, vacancy.HRM);

            Assert.AreEqual(1, result.Candidates.Count);
        }