public void DeleteAsync_CallsRepository_WhenExistsWithId() { A.CallTo(() => _publisherDecorator.IsExistByIdAsync(Id)) .Returns(true); _publisherService.DeleteAsync(Id); A.CallTo(() => _publisherDecorator.DeleteAsync(Id)).MustHaveHappenedOnceExactly(); }
public async Task DeleteAsync(string id) { var exists = await _publisherDecorator.IsExistByIdAsync(id); if (!exists) { throw new EntityNotFoundException <Publisher>(id); } await _publisherDecorator.DeleteAsync(id); await _unitOfWork.CommitAsync(); }