public void WhenSuggestionCommentDoesNotExists_ShouldThrowANotFoundException() => ShouldThrowDuringTheValidation <NotFoundException>(() => { AddTheValidSuggestion(); var suggestion = _dbContext.Suggestions.First(); var comment = suggestion.Comments.First(); _repository.RemoveUserComment(suggestion.Id, comment.Id, comment.CreatedBy); _dbContext.SaveChanges(); });
public async Task <Suggestion> Handle(DeleteASuggestionCommentCommand deleteASuggestionComment, CancellationToken cancellationToken = default) { var validationContext = new DeleteASuggestionCommentValidationContext(deleteASuggestionComment, _repository); _deleteCommentValidator.Validate(validationContext); var suggestion = _repository.RemoveUserComment(deleteASuggestionComment.SuggestionId, deleteASuggestionComment.Id, deleteASuggestionComment.UserId); await _dbContext.SaveChangesAsync(); return(suggestion); }