Exemplo n.º 1
0
        public async Task CanDeleteAttachment()
        {
            if (NoManagement())
            {
                return;
            }

            var knownId = Guid.NewGuid().ToString("N");

            using (var source = new MemoryStream(new byte[0]))
            {
                await _storage.Save(knownId, source);
            }

            using (var sourceStream = await _storage.Read(knownId))
            {
                Assert.That(sourceStream, Is.Not.Null,
                            $"Expected a successful opening + not-null-check when trying to read attachment with ID {knownId}");
            }

            await _management.Delete(knownId);

            var exception = Assert.ThrowsAsync <ArgumentException>(() => _storage.Read(knownId),
                                                                   $"Expected an ArgumentException, because the attachment with ID {knownId} was deleted");

            Console.WriteLine(exception);

            Assert.That(exception.ToString(), Contains.Substring(knownId));
        }
Exemplo n.º 2
0
 public Task Delete(string dataBusAttachmentId) => _dataBusStorageManagement.Delete(dataBusAttachmentId);