public ActionResult <SummaryDto> GetForUser([FromHeader] Guid token, Int32 userId) { try { ValidateToken(token); return(Ok(_summaryService.GetForUser(userId))); } catch (AuthenticationException) { return(Unauthorized()); } catch (ArgumentException e) { return(NotFound(e.Message)); } }
public void Should_return_summary_for_user_same_as_from_repository() { // Arrange var userId = 1; var expected = SummaryDto.Create(_summaryRepository.GetForUser(userId)); // Act var result = _summaryService.GetForUser(userId); // Assert Assert.That(result != null); Assert.That(result.Equals(expected)); }