public ActionResult <List <SummarySuggestionDto> > GetAll([FromHeader] Guid token) { try { Int32 currentUserId = ValidateToken(token); return(Ok(_summarySuggestionService.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 SummaryCompiler(); var expected = compiler.Compile(_summaryRepository.Get(), _rule); // Act var result = _summarySuggestionService.SuggestAllForUser(0); // Assert Assert.That(result, Is.Not.Null); Assert.That(result.Count, Is.EqualTo(expected.Count())); Assert.That(result.Select(s => s.Summary.Id), Is.EquivalentTo(expected.Select(s => s.Id))); }