public void Should_create_new_vacancy_for_user_in_repository() { // Arrange var userId = 6; var vacancyData = new CreateVacancyDto( "Spec2", new List <String> { "Skill1", "Skill3" }, "Inform"); var expected = new VacancyDto( userId, 2, vacancyData.Specialization, vacancyData.Skills, vacancyData.Information); // Act var result = _vacancyService.CreateForUser(userId, vacancyData); // Assert Assert.That(result != null); Assert.That(result.Equals(expected)); Assert.That(result.Equals(VacancyDto.Create(_vacancyRepository.GetForUser(userId)))); }
private Vacancy GetVacancyForUser(Int32 userId) { User user = _userRepository.Get(userId); if (user.Type != UserType.Recruiter) { throw new ArgumentException($"User with id {userId} is not recruiter!"); } Vacancy vacancy = _vacancyRepository.GetForUser(userId); return(vacancy); }
public VacancyDto GetForUser(Int32 userId) { return(VacancyDto.Create(_vacancyRepository.GetForUser(userId))); }