public async Task HowToBecomeSegmentServiceDeleteReturnsSuccessWhenSegmentDeleted() { // arrange A.CallTo(() => repository.DeleteAsync(documentId)).Returns(HttpStatusCode.NoContent); // act var result = await howToBecomeSegmentService.DeleteAsync(documentId).ConfigureAwait(false); // assert A.CallTo(() => repository.DeleteAsync(documentId)).MustHaveHappenedOnceExactly(); Assert.True(result); }
public async Task <IActionResult> Delete(Guid documentId) { logService.LogInformation($"{DeleteActionName} has been called"); var isDeleted = await howToBecomeSegmentService.DeleteAsync(documentId).ConfigureAwait(false); if (isDeleted) { logService.LogInformation($"{DeleteActionName} has deleted content for document Id: {documentId}"); return(Ok()); } else { logService.LogWarning($"{DeleteActionName} has returned no content for: {documentId}"); return(NotFound()); } }