public async Task <RemovalInfo> RemoveAsync(string fileName)
        {
            var removalInfo = await _fileStorageHandler.RemoveFileFromStorageAsync(fileName);

            if (removalInfo.IsRemoved)
            {
                await _pdfDocumentRepository.RemovePdfDocumentAsync(fileName);
            }

            return(new RemovalInfo {
                Status = removalInfo.Status
            });
        }
예제 #2
0
        public async Task RemovePdfDocumentAsync_DocumentRemoved()
        {
            //Arrange
            var documentId = _fixture.Create <string>();

            var documentClientMock = new Mock <IDocumentClient>();

            _documentClientFactoryMock
            .Setup(factory => factory.GetClient())
            .Returns(documentClientMock.Object);

            //Act
            await _sut.RemovePdfDocumentAsync(documentId);

            //Assert
            documentClientMock.Verify(
                client => client.DeleteDocumentAsync(
                    It.IsAny <Uri>(),
                    It.IsAny <RequestOptions>(),
                    It.IsAny <CancellationToken>()),
                Times.Once);
        }