public async Task DeletingAttachment_RemovesAttachmentFromBlobStorage()
        {
            var result = await _dut.Handle(_command, default);

            Assert.AreEqual(ResultType.Ok, result.ResultType);
            _blobStorageMock.Verify(x => x.DeleteAsync(It.IsAny <string>(), default), Times.Once);
        }
コード例 #2
0
        public async Task Handle_AttachmentNotFound_ShouldThrowNotFoundException()
        {
            // Arrange
            var attachment = await _wolkDbContext.CreateAndSaveAttachment();

            var request = new DeleteAttachmentCommand {
                AttachmentId = attachment.Id + 1
            };

            // Act / Assert
            await Assert.ThrowsExceptionAsync <NotFoundException>(() =>
                                                                  _handler.Handle(request, CancellationToken.None));
        }