public void TestDeleteFile()
        {
            // Arrange
            AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem();

            // Act
            provider.AddFile("1010/media.jpg", Stream.Null);

            // Assert
            Assert.IsTrue(provider.FileExists("1010/media.jpg"));

            // Act
            provider.DeleteFile("1010/media.jpg");

            // Assert
            Assert.IsFalse(provider.FileExists("1010/media.jpg"));
        }
        public void TestOpenFilePrefixed()
        {
            // Arrange
            AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem();

            using (MemoryStream expected = new MemoryStream(Encoding.UTF8.GetBytes("test")))
            {
                // Act
                provider.AddFile("media/1010/media.jpg", expected);

                // Assert
                using (Stream actual = provider.OpenFile("media/1010/media.jpg"))
                {
                    Assert.AreEqual(expected, actual);
                }
            }
        }
Пример #3
0
        public void TestDeleteDirectoryRelative()
        {
            // Arrange
            AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem();

            // Act
            provider.AddFile("media/1010/media.jpg", Stream.Null);

            // Assert
            Assert.IsTrue(provider.DirectoryExists("media/1010"));

            // Act
            provider.DeleteDirectory("\\media\\1010");

            // Assert
            Assert.IsFalse(provider.DirectoryExists("media/1010/"));
            Assert.IsFalse(provider.FileExists("media/1010/media.jpg"));
        }
Пример #4
0
        public void TestDeleteDirectoryRelative()
        {
            // Arrange
            AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem();

            // Act
            provider.AddFile($"{this.ContainerName}/1010/image.jpg", Stream.Null);

            // Assert
            Assert.IsTrue(provider.DirectoryExists($"{this.ContainerName}/1010"));

            // Act
            provider.DeleteDirectory($"\\{this.ContainerName}\\1010");

            // Assert
            Assert.IsFalse(provider.DirectoryExists($"{this.ContainerName}/1010/"));
            Assert.IsFalse(provider.FileExists($"{this.ContainerName}/1010/image.jpg"));
        }