コード例 #1
0
        public void Should_decrease_suggestions_count_after_accepting()
        {
            // Arrange
            var expected = _vacancySuggestionService.SuggestAllForUser(0).Count - 1;

            // Act
            var suggestion = _vacancySuggestionService.SuggestForUser(0);

            _vacancySuggestionService.AcceptSuggestionForUser(0, suggestion.Id);
            var result = _vacancySuggestionService.SuggestAllForUser(0).Count;

            // Assert
            Assert.That(result, Is.EqualTo(expected));
        }
コード例 #2
0
 public ActionResult Accept([FromHeader] Guid token, Int32 suggestionId)
 {
     try
     {
         Int32 currentUserId = ValidateToken(token);
         _vacancySuggestionService.AcceptSuggestionForUser(currentUserId, suggestionId);
         return(Ok());
     }
     catch (AuthenticationException)
     {
         return(Unauthorized());
     }
     catch (ArgumentException e)
     {
         return(NotFound(e.Message));
     }
 }