Example #1
0
 public ActionResult <List <VacancySuggestionDto> > GetAll([FromHeader] Guid token)
 {
     try
     {
         Int32 currentUserId = ValidateToken(token);
         return(Ok(_vacancySuggestionService.SuggestAllForUser(currentUserId)));
     }
     catch (AuthenticationException)
     {
         return(Unauthorized());
     }
     catch (ArgumentException e)
     {
         return(NotFound(e.Message));
     }
 }
        public void Should_create_suggestions_for_user_when_it_have_not_in_repository()
        {
            // Arrange
            var compiler = new VacancyCompiler();
            var expected = compiler.Compile(_vacancyRepository.Get(), _rule);

            // Act
            var result = _vacancySuggestionService.SuggestAllForUser(0);

            // Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count, Is.EqualTo(expected.Count()));
            Assert.That(result.Select(s => s.Vacancy.Id), Is.EquivalentTo(expected.Select(s => s.Id)));
        }