public void List_Files_Recursive() { this.Initialize(); int page_count = 0; int child_count = 0; var lfo = new ListFilesOptions(); lfo.PageSize = 4; var pages = this.StoreClient.FileSystem.ListFilesRecursivePaged(FsPath.Root, lfo); foreach (var page in pages) { foreach (var child in page.FileItems) { child_count++; } page_count++; if (page_count == 3) { break; } } Assert.AreEqual(3,page_count); Assert.AreEqual(3*4,child_count); }
public void List_Files_Non_Recursive() { this.Initialize(); int page_count = 0; int child_count = 0; var lfo = new ListFilesOptions(); lfo.PageSize = 4; var pages = this.StoreClient.FileSystem.ListFilesPaged(FsPath.Root, lfo); foreach (var page in pages) { foreach (var fileitem in page.FileItems) { child_count++; } page_count++; } }
public IEnumerable <FsFileStatusPage> ListFilesPaged(StoreAccount store, FsPath path, ListFilesOptions options) { string after = null; while (true) { var result = RestClient.FileSystem.ListFileStatus(store.Name, path.ToString(), options.PageSize, after); if (result.FileStatuses.FileStatus.Count > 0) { var page = new FsFileStatusPage(); page.Path = path; page.FileItems = result.FileStatuses.FileStatus.Select(i => new FsFileStatus(i)).ToList(); yield return(page); after = result.FileStatuses.FileStatus[result.FileStatuses.FileStatus.Count - 1].PathSuffix; } else { break; } } }