Skip to content

Commit ef6ec3b

Browse files
committed
tests: test changes for using await foreach
(Other changes are just in terms of the BOM.)
1 parent cf163a5 commit ef6ec3b

File tree

27 files changed

+143
-158
lines changed

27 files changed

+143
-158
lines changed

Google.Api.Generator.Tests/ProtoTests/Basic.v1/Testing.Basic.V1.GeneratedSnippets/Testing.Basic.V1.GeneratedSnippets.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
<ItemGroup>
1010
<ProjectReference Include="../Testing.Basic.V1/Testing.Basic.V1.csproj" />
11-
<PackageReference Include="System.Linq.Async" Version="6.0.3" />
1211
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
1312
</ItemGroup>
1413

Google.Api.Generator.Tests/ProtoTests/Basic.v1/Testing.Basic.V1.Snippets/Testing.Basic.V1.Snippets.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
<ItemGroup>
1010
<ProjectReference Include="../Testing.Basic.V1/Testing.Basic.V1.csproj" />
11-
<PackageReference Include="System.Linq.Async" Version="6.0.3" />
1211
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
1312
</ItemGroup>
1413

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod1AsyncSnippet.g.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ namespace GoogleCSharpSnippets
1919
// [START paginated_generated_Paginated_ResourcedMethod_async_flattened1]
2020
using Google.Api.Gax;
2121
using System;
22-
using System.Linq;
2322
using System.Threading.Tasks;
2423
using Testing.Paginated;
2524

@@ -43,14 +42,14 @@ public async Task ResourcedMethod1Async()
4342
PagedAsyncEnumerable<ResourceResponse, string> response = paginatedClient.ResourcedMethodAsync(name);
4443

4544
// Iterate over all response items, lazily performing RPCs as required
46-
await response.ForEachAsync((string item) =>
45+
await foreach (string item in response)
4746
{
4847
// Do something with each item
4948
Console.WriteLine(item);
50-
});
49+
}
5150

5251
// Or iterate over pages (of server-defined size), performing one RPC per page
53-
await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
52+
await foreach (ResourceResponse page in response.AsRawResponses())
5453
{
5554
// Do something with each page of items
5655
Console.WriteLine("A page of results:");
@@ -59,7 +58,7 @@ await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
5958
// Do something with each item
6059
Console.WriteLine(item);
6160
}
62-
});
61+
}
6362

6463
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
6564
int pageSize = 10;

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod1ResourceNamesAsyncSnippet.g.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ namespace GoogleCSharpSnippets
1919
// [START paginated_generated_Paginated_ResourcedMethod_async_flattened1_resourceNames]
2020
using Google.Api.Gax;
2121
using System;
22-
using System.Linq;
2322
using System.Threading.Tasks;
2423
using Testing.Paginated;
2524

@@ -43,14 +42,14 @@ public async Task ResourcedMethod1ResourceNamesAsync()
4342
PagedAsyncEnumerable<ResourceResponse, string> response = paginatedClient.ResourcedMethodAsync(name);
4443

4544
// Iterate over all response items, lazily performing RPCs as required
46-
await response.ForEachAsync((string item) =>
45+
await foreach (string item in response)
4746
{
4847
// Do something with each item
4948
Console.WriteLine(item);
50-
});
49+
}
5150

5251
// Or iterate over pages (of server-defined size), performing one RPC per page
53-
await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
52+
await foreach (ResourceResponse page in response.AsRawResponses())
5453
{
5554
// Do something with each page of items
5655
Console.WriteLine("A page of results:");
@@ -59,7 +58,7 @@ await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
5958
// Do something with each item
6059
Console.WriteLine(item);
6160
}
62-
});
61+
}
6362

6463
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
6564
int pageSize = 10;

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod1ResourceNamesSnippet.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod1Snippet.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod2AsyncSnippet.g.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ namespace GoogleCSharpSnippets
1919
// [START paginated_generated_Paginated_ResourcedMethod_async_flattened2]
2020
using Google.Api.Gax;
2121
using System;
22-
using System.Linq;
2322
using System.Threading.Tasks;
2423
using Testing.Paginated;
2524

@@ -44,14 +43,14 @@ public async Task ResourcedMethod2Async()
4443
PagedAsyncEnumerable<ResourceResponse, string> response = paginatedClient.ResourcedMethodAsync(name, extraString: extraString);
4544

4645
// Iterate over all response items, lazily performing RPCs as required
47-
await response.ForEachAsync((string item) =>
46+
await foreach (string item in response)
4847
{
4948
// Do something with each item
5049
Console.WriteLine(item);
51-
});
50+
}
5251

5352
// Or iterate over pages (of server-defined size), performing one RPC per page
54-
await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
53+
await foreach (ResourceResponse page in response.AsRawResponses())
5554
{
5655
// Do something with each page of items
5756
Console.WriteLine("A page of results:");
@@ -60,7 +59,7 @@ await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
6059
// Do something with each item
6160
Console.WriteLine(item);
6261
}
63-
});
62+
}
6463

6564
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
6665
int pageSize = 10;

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod2ResourceNamesAsyncSnippet.g.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@ namespace GoogleCSharpSnippets
1919
// [START paginated_generated_Paginated_ResourcedMethod_async_flattened2_resourceNames]
2020
using Google.Api.Gax;
2121
using System;
22-
using System.Linq;
2322
using System.Threading.Tasks;
2423
using Testing.Paginated;
2524

@@ -44,14 +43,14 @@ public async Task ResourcedMethod2ResourceNamesAsync()
4443
PagedAsyncEnumerable<ResourceResponse, string> response = paginatedClient.ResourcedMethodAsync(name, extraString: extraString);
4544

4645
// Iterate over all response items, lazily performing RPCs as required
47-
await response.ForEachAsync((string item) =>
46+
await foreach (string item in response)
4847
{
4948
// Do something with each item
5049
Console.WriteLine(item);
51-
});
50+
}
5251

5352
// Or iterate over pages (of server-defined size), performing one RPC per page
54-
await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
53+
await foreach (ResourceResponse page in response.AsRawResponses())
5554
{
5655
// Do something with each page of items
5756
Console.WriteLine("A page of results:");
@@ -60,7 +59,7 @@ await response.AsRawResponses().ForEachAsync((ResourceResponse page) =>
6059
// Do something with each item
6160
Console.WriteLine(item);
6261
}
63-
});
62+
}
6463

6564
// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
6665
int pageSize = 10;

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod2ResourceNamesSnippet.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

Google.Api.Generator.Tests/ProtoTests/Paginated/Testing.Paginated.GeneratedSnippets/PaginatedClient.ResourcedMethod2Snippet.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)