public void TestGetSubDirectoriesAndFiles() { // Arrange AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem(); provider.AddFile("forms/form_123/kitty.jpg", Stream.Null); provider.AddFile("forms/form_123/dog.jpg", Stream.Null); provider.AddFile("forms/form_456/panda.jpg", Stream.Null); // Act var subfolders = provider.GetDirectories("forms"); var actual = new List <string>(); foreach (var folder in subfolders) { // Get files in subfolder and add to a single collection actual.AddRange(provider.GetFiles(folder)); } // Assert string[] expected = { "forms/form_123/dog.jpg", "forms/form_123/kitty.jpg", "forms/form_456/panda.jpg" }; Assert.IsTrue(expected.SequenceEqual(actual)); // Tidy up after test provider.DeleteDirectory("forms"); }
public void TestValidDirectory() { AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem(); provider.AddFile("testvalid/test.txt", Stream.Null); Assert.IsTrue(provider.DirectoryExists("testvalid")); // Tidy up after test provider.DeleteDirectory("testvalid"); }
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")); }
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")); }
public void TestDeleteDirectory() { // Arrange AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem(); // Act provider.AddFile("1010/image.jpg", Stream.Null); // Assert Assert.IsTrue(provider.DirectoryExists("1010/")); // Act provider.DeleteDirectory("1010/"); // Assert Assert.IsFalse(provider.DirectoryExists("1010/")); Assert.IsFalse(provider.FileExists("1010/image.jpg")); }
public void TestGetSubDirectories() { // Arrange AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem(); provider.AddFile("forms/form_123/kitty.jpg", Stream.Null); provider.AddFile("forms/form_123/dog.jpg", Stream.Null); provider.AddFile("forms/form_456/panda.jpg", Stream.Null); // Act IEnumerable <string> actual = provider.GetDirectories("forms"); // Assert string[] expected = { "forms/form_123", "forms/form_456" }; Assert.IsTrue(expected.SequenceEqual(actual)); // Tidy up after test provider.DeleteDirectory("forms"); }