From d771ba16ab7bc293e3f913324ba9e9b52cb2bd82 Mon Sep 17 00:00:00 2001 From: Amanda Nguyen <48961492+amnguye@users.noreply.github.com> Date: Tue, 3 Jan 2023 15:09:47 -0800 Subject: [PATCH] Removed use of TestExtensions.ToList in datalake samples (#33118) --- .../samples/Sample01b_HelloWorldAsync.cs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/sdk/storage/Azure.Storage.Files.DataLake/samples/Sample01b_HelloWorldAsync.cs b/sdk/storage/Azure.Storage.Files.DataLake/samples/Sample01b_HelloWorldAsync.cs index 086977b732de0..c00d412854193 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/samples/Sample01b_HelloWorldAsync.cs +++ b/sdk/storage/Azure.Storage.Files.DataLake/samples/Sample01b_HelloWorldAsync.cs @@ -43,8 +43,11 @@ public async Task CreateFileClientAsync_Filesystem() await file.CreateAsync(); // Verify we created one file - AsyncPageable response = filesystem.GetPathsAsync(); - IList paths = await response.ToListAsync(); + List paths = new List(); + await foreach (PathItem path in filesystem.GetPathsAsync()) + { + paths.Add(path); + } Assert.AreEqual(1, paths.Count); // Cleanup @@ -80,8 +83,11 @@ public async Task CreateFileClientAsync_Directory() await file.CreateAsync(); // Verify we created one file - AsyncPageable response = filesystem.GetPathsAsync(); - IList paths = await response.ToListAsync(); + List paths = new List(); + await foreach (PathItem path in filesystem.GetPathsAsync()) + { + paths.Add(path); + } Assert.AreEqual(1, paths.Count); // Cleanup @@ -113,8 +119,11 @@ public async Task CreateDirectoryClientAsync() await directory.CreateAsync(); // Verify we created one directory - AsyncPageable response = filesystem.GetPathsAsync(); - IList paths = await response.ToListAsync(); + List paths = new List(); + await foreach (PathItem path in filesystem.GetPathsAsync()) + { + paths.Add(path); + } Assert.AreEqual(1, paths.Count); // Cleanup @@ -198,8 +207,11 @@ public async Task AppendAsync() await file.CreateAsync(); // Verify we created one file - AsyncPageable response = filesystem.GetPathsAsync(); - IList paths = await response.ToListAsync(); + List paths = new List(); + await foreach (PathItem path in filesystem.GetPathsAsync()) + { + paths.Add(path); + } Assert.AreEqual(1, paths.Count); // Append data to an existing DataLake File. Append is currently limited to 4000 MB per call.