Пример #1
0
        private void DeletePhoto()
        {
            var item = SelectedItem;

            SelectedSection?.DeleteSelectedItem();
            OnPropertyChanged(nameof(SelectedItem));
            _photoStore.DeletePhoto(item.PhotoId);
            OnPropertyChanged(nameof(SelectedSection));
            OnPropertyChanged(nameof(Sections));
        }
Пример #2
0
        public async Task DeletePhotoReturnsSuccessfullyWhenContainerNotFoundTest()
        {
            // Retrieve storage account from connection-string
            var storageAccount = CloudStorageAccount.Parse(Config.Storage.ConnectionString);

            // Create the client
            var client = storageAccount.CreateCloudBlobClient();

            var container = client.GetContainerReference("photos");

            await container.DeleteIfExistsAsync().ConfigureAwait(false);

            var sut = new PhotoStore(Config.Storage);

            // This should not throw an exception
            await sut.DeletePhoto(Guid.NewGuid(), Guid.NewGuid(), CancellationToken.None).ConfigureAwait(false);
        }
Пример #3
0
        public async Task DeletePhotoRemovesPhotoBlobTest()
        {
            var photo    = Model.Ignoring <Photo>(x => x.Data).Create <Photo>().Set(x => x.ContentType = ".jpg");
            var expected = Model.Create <byte[]>();

            var sut = new PhotoStore(Config.Storage);

            using (var inputStream = new MemoryStream(expected))
            {
                photo.Data = inputStream;

                await sut.StorePhoto(photo, CancellationToken.None).ConfigureAwait(false);
            }

            await sut.DeletePhoto(photo.ProfileId, photo.Id, CancellationToken.None).ConfigureAwait(false);

            var actual = await sut.GetPhoto(photo.ProfileId, photo.Id, CancellationToken.None)
                         .ConfigureAwait(false);

            actual.Should().BeNull();
        }