Example #1
0
        private static async Task<IDirectoryInfo> GetSubfolderAsync(IDirectoryInfo parent, string name)
        {
            IDirectoryInfo output = await parent.GetDirectoryAsync(name);
            if (output == null)
            {
                output = await parent.CreateDirectoryAsync(name);
            }

            return output;
        }
Example #2
0
        public async Task CreateFolderWorks()
        {
            var folderName = "Test";
            var folderOne  = await TestRootFolder.CreateDirectoryAsync(folderName);

            var folders = await TestRootFolder.EnumerateDirectoriesAsync();

            var items = await TestRootFolder.EnumerateItemsAsync();

            Assert.Collection(folders, d => Assert.Equal(folderOne, d));
            Assert.Single(items);

            var item = await TestRootFolder.GetDirectoryAsync(folderName);

            Assert.NotNull(item);
            item = await TestRootFolder.GetDirectoryAsync("notExistent");

            Assert.Null(item);
        }