Esempio n. 1
0
        public void Should_delete_summary_by_id_from_repository()
        {
            // Arrange
            var summaryId = 0;
            var expected  = _summaryService.Get(summaryId);

            // Act
            var result = _summaryService.Delete(summaryId);

            // Assert
            Assert.That(result.Equals(expected));
            Assert.Throws <ArgumentException>(() => _summaryRepository.Get(summaryId));
        }
Esempio n. 2
0
 public ActionResult <SummaryDto> Delete([FromHeader] Guid token, Int32 summaryId)
 {
     try
     {
         Int32 currentUserId = ValidateToken(token);
         return(Ok(_summaryService.Delete(summaryId)));
     }
     catch (AuthenticationException)
     {
         return(Unauthorized());
     }
     catch (ArgumentException e)
     {
         return(BadRequest());
     }
 }