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 TestGetDirectoriesPrefixed() { // Arrange AzureBlobFileSystem provider = this.CreateAzureBlobFileSystem(); provider.AddFile("media/1010/media.jpg", Stream.Null); provider.AddFile("media/1011/media.jpg", Stream.Null); provider.AddFile("media/1012/media.jpg", Stream.Null); // Act IEnumerable <string> actual = provider.GetDirectories("/"); // Assert string[] expected = { "1010", "1011", "1012" }; Assert.IsTrue(expected.SequenceEqual(actual)); }
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"); }