public async Task Should_be_able_to_search()
        {
            var file = await ResourceHelpers.CreateFileWithContentAsync(ResourceHelpers.GetLocalDevelopmentContainer(), $"folder1/folder2/folder3/{Guid.NewGuid()}.txt", "stuff");

            var sut = new BlobStorageDirectory(ResourceHelpers.GetLocalDevelopmentContainer(), "folder1");

            var level1List = await sut.GetDirectoriesAsync();

            level1List.Should().NotBeEmpty();

            await sut.DeleteAsync();
        }
        public async Task Should_represent_directory()
        {
            await ResourceHelpers.CreateFileWithContentAsync(ResourceHelpers.GetLocalDevelopmentContainer(), $"folder1/folder2/folder3/{Guid.NewGuid()}.txt", "stuff");

            var sut = new BlobStorageDirectory(ResourceHelpers.GetLocalDevelopmentContainer(), "folder1");

            sut.IsDirectory.Should().BeTrue();
            sut.Name.Should().Be("folder1/");


            await sut.DeleteAsync();
        }
Beispiel #3
0
        public async Task Should_list_all_nodes_at_root()
        {
            await ResourceHelpers.CreateFileWithContentAsync(ResourceHelpers.GetLocalDevelopmentContainer(), $"{Guid.NewGuid()}.txt", "stuff");

            var sut = new BlobStorageDirectory(ResourceHelpers.GetLocalDevelopmentContainer(), "");

            var nodes = await sut.GetFilesAsync();

            nodes.Count().Should().BeGreaterOrEqualTo(1);

            await sut.DeleteAsync();
        }
        public async Task Should_list_all_nodes()
        {
            await ResourceHelpers.CreateFileWithContentAsync(ResourceHelpers.GetLocalDevelopmentContainer(), $"folder1/{Guid.NewGuid()}.txt", "stuff");

            await ResourceHelpers.CreateFileWithContentAsync(ResourceHelpers.GetLocalDevelopmentContainer(), $"folder1/folder2/{Guid.NewGuid()}.txt", "stuff");

            var sut = new BlobStorageDirectory(ResourceHelpers.GetLocalDevelopmentContainer(), "folder1");

            var nodes = sut.ToList();

            nodes.Count(x => x.IsDirectory).Should().Be(1);
            nodes.Count(x => !x.IsDirectory).Should().Be(1);

            await sut.DeleteAsync();
        }
Beispiel #5
0
        public async Task Should_delete_a_directory()
        {
            var file = new BlobStorageFile(ResourceHelpers.GetLocalDevelopmentContainer(), $"folder1/folder2/folder3/{Guid.NewGuid()}.txt");

            using (var stream = await file.OpenWriteAsync())
                using (var writer = new StreamWriter(stream))
                {
                    writer.Write("test");
                }

            var sut = new BlobStorageDirectory(ResourceHelpers.GetLocalDevelopmentContainer(), "folder1");

            sut.Exists.Should().BeTrue();
            await sut.DeleteAsync();
        }
Beispiel #6
0
 public async Task Should_not_throw_exception_when_directory_not_present()
 {
     var sut = new BlobStorageDirectory(ResourceHelpers.GetLocalDevelopmentContainer(), "does_not_exist");
     await sut.DeleteAsync();
 }