Пример #1
0
        public async Task DesktopStorageCreateContainer()
        {
            // Arrange
            IStorage storage = new FileSystemStorage(this._storagePath);

            // Act
            var container = await storage.CreateOrGetContainerAsync("FileSystemStorageCreateContainer", ContainerPermission.Public, failIfExists : true);

            // Assert
            Assert.NotNull(container);
        }
Пример #2
0
        public async Task DesktopStorageTryCreateContainer()
        {
            // Arrange
            IStorage         storage = new FileSystemStorage(this._storagePath);
            StorageException ex      = null;

            // Act
            try {
                await storage.CreateOrGetContainerAsync(FileSystemStorageTests._precreatedContainerName, ContainerPermission.Public, failIfExists : true);
            }
            catch (StorageException e) {
                ex = e;
            }

            // Assert
            Assert.NotNull(ex);
            Assert.Equal(StorageExceptionReason.ContainerExistAlready, ex.Reason);
        }
Пример #3
0
        public async Task DesktopStorageTryToDeleteContainer()
        {
            // Arrange
            IStorage     storage       = new FileSystemStorage(this._storagePath);
            const string containerName = "DesktopStorageTryToDeleteContainer";

            await storage.CreateOrGetContainerAsync(containerName, ContainerPermission.Public, failIfExists : false);

            var storages1 = await storage.GetContainersListAsync(containerName);

            // Act

            await storage.DeleteContainerAsync(containerName);

            var storages2 = await storage.GetContainersListAsync(containerName);

            // Assert
            Assert.NotNull(storages1);
            Assert.NotNull(storages2);
            Assert.True(storages1.All(c => string.Equals(c, containerName)));
            Assert.False(storages2.Any());
        }
        public async Task DesktopStorageTryCreateContainer()
        {
            // Arrange
            IStorage storage = new FileSystemStorage(this._storagePath);
            StorageException ex = null;

            // Act
            try {
                await storage.CreateOrGetContainerAsync(FileSystemStorageTests._precreatedContainerName, ContainerPermission.Public, failIfExists: true);
            }
            catch (StorageException e) {
                ex = e;
            }

            // Assert
            Assert.NotNull(ex);
            Assert.Equal(StorageExceptionReason.ContainerExistAlready, ex.Reason);
        }
        public async Task DesktopStorageCreateContainer()
        {
            // Arrange
            IStorage storage = new FileSystemStorage(this._storagePath);

            // Act
            var container = await storage.CreateOrGetContainerAsync("FileSystemStorageCreateContainer", ContainerPermission.Public, failIfExists: true);

            // Assert
            Assert.NotNull(container);
        }
        public async Task DesktopStorageTryToDeleteContainer()
        {
            // Arrange
            IStorage storage = new FileSystemStorage(this._storagePath);
            const string containerName = "DesktopStorageTryToDeleteContainer";

            await storage.CreateOrGetContainerAsync(containerName, ContainerPermission.Public, failIfExists: false);
            var storages1 = await storage.GetContainersListAsync(containerName);

            // Act

            await storage.DeleteContainerAsync(containerName);
            var storages2 = await storage.GetContainersListAsync(containerName);

            // Assert
            Assert.NotNull(storages1);
            Assert.NotNull(storages2);
            Assert.True(storages1.All(c => string.Equals(c, containerName)));
            Assert.False(storages2.Any());
        }