Skip to content

Commit 4ced6e7

Browse files
Update autorest.csharp to 3.0.0-beta.20221012.1 (#31770)
* Update autorest.csharp to 3.0.0-beta.20221012.1 * Remove workarounds for Question Answering Now that we're fixing Azure/autorest.csharp#2726 I can remove the workarounds. Also, some tests were only recorded because we have never sent the `Accept` request header in LROs, which the explicit method calls generated on the client did. That's tracked in Azure/autorest.csharp#2765 Co-authored-by: Heath Stewart <[email protected]>
1 parent 41980e6 commit 4ced6e7

File tree

12 files changed

+758
-1170
lines changed

12 files changed

+758
-1170
lines changed

eng/Packages.Data.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
All should have PrivateAssets="All" set so they don't become package dependencies
161161
-->
162162
<ItemGroup>
163-
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20220923.1" PrivateAssets="All" />
163+
<PackageReference Update="Microsoft.Azure.AutoRest.CSharp" Version="3.0.0-beta.20221012.1" PrivateAssets="All" />
164164
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20220111.2" PrivateAssets="All" />
165165
<PackageReference Update="coverlet.collector" Version="1.3.0" PrivateAssets="All" />
166166
<PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.1" PrivateAssets="All" />

sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/tests/QuestionAnsweringAuthoringClientLiveTests.cs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,11 @@ public async Task DeployProject()
8080
Operation<AsyncPageable<BinaryData>> updateSourcesOperation = await Client.UpdateSourcesAsync(WaitUntil.Completed, testProjectName, updateSourcesRequestContent);
8181

8282
string testDeploymentName = "production";
83-
Operation<BinaryData> deploymentOperation = await Client.DeployProjectAsync(WaitUntil.Started, testProjectName, testDeploymentName);
84-
85-
await deploymentOperation.WaitForCompletionAsync();
86-
AsyncPageable<BinaryData> deployments = Client.GetDeploymentsAsync(testProjectName);
83+
Operation<BinaryData> deploymentOperation = await Client.DeployProjectAsync(WaitUntil.Completed, testProjectName, testDeploymentName);
84+
BinaryData deployment = deploymentOperation.Value;
8785

8886
Assert.True(deploymentOperation.HasCompleted);
89-
Assert.That((await deployments.ToEnumerableAsync()).Any(deployment => deployment.ToString().Contains(testDeploymentName)));
87+
Assert.That(deployment.ToString(), Contains.Substring(testDeploymentName));
9088
}
9189

9290
[RecordedTest]
@@ -114,12 +112,7 @@ public async Task UpdateQnAs()
114112
});
115113

116114
Operation<AsyncPageable<BinaryData>> updateQnasOperation = await Client.UpdateQnasAsync(WaitUntil.Completed, testProjectName, updateQnasRequestContent);
117-
118-
// BUGBUG: This gets the job state.
119-
// AsyncPageable<BinaryData> sources = updateQnasOperation.Value;
120-
121-
// This works, but is not the intended use case.
122-
AsyncPageable<BinaryData> sources = Client.GetQnasAsync(testProjectName);
115+
AsyncPageable<BinaryData> sources = updateQnasOperation.Value;
123116

124117
Assert.True(updateQnasOperation.HasCompleted);
125118
Assert.AreEqual(200, updateQnasOperation.GetRawResponse().Status);
@@ -152,12 +145,7 @@ public async Task UpdateSources()
152145
});
153146

154147
Operation<AsyncPageable<BinaryData>> updateSourcesOperation = await Client.UpdateSourcesAsync(WaitUntil.Completed, testProjectName, updateSourcesRequestContent);
155-
156-
// BUGBUG: This gets the job state.
157-
// AsyncPageable<BinaryData> sources = updateSourcesOperation.Value;
158-
159-
// This works, but is not the intended use case.
160-
AsyncPageable<BinaryData> sources = Client.GetSourcesAsync(testProjectName);
148+
AsyncPageable<BinaryData> sources = updateSourcesOperation.Value;
161149

162150
Assert.True(updateSourcesOperation.HasCompleted);
163151
Assert.AreEqual(200, updateSourcesOperation.GetRawResponse().Status);

sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/tests/Samples/Sample3_CreateAndDeployProject.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,8 @@ public void CreateAndDeploy()
7878

7979
Operation<Pageable<BinaryData>> updateSourcesOperation = client.UpdateSources(WaitUntil.Completed, newProjectName, updateSourcesRequestContent);
8080

81-
#if SNIPPET
8281
// Knowledge Sources can be retrieved as follows
8382
Pageable<BinaryData> sources = updateSourcesOperation.Value;
84-
#else
85-
// TODO: Remove this condition once https://github.com/Azure/autorest.csharp/issues/2726 is fixed.
86-
Pageable<BinaryData> sources = client.GetSources(newProjectName);
87-
#endif
8883

8984
Console.WriteLine("Sources: ");
9085
foreach (BinaryData source in sources)
@@ -186,13 +181,8 @@ public async Task CreateAndDeployAsync()
186181

187182
Operation<AsyncPageable<BinaryData>> updateSourcesOperation = await client.UpdateSourcesAsync(WaitUntil.Completed, newProjectName, updateSourcesRequestContent);
188183

189-
#if SNIPPET
190184
// Knowledge Sources can be retrieved as follows
191185
AsyncPageable<BinaryData> sources = updateSourcesOperation.Value;
192-
#else
193-
// TODO: Remove this condition once https://github.com/Azure/autorest.csharp/issues/2726 is fixed.
194-
AsyncPageable<BinaryData> sources = client.GetSourcesAsync(newProjectName);
195-
#endif
196186

197187
Console.WriteLine("Sources: ");
198188
await foreach (BinaryData source in sources)

sdk/cognitivelanguage/Azure.AI.Language.QuestionAnswering/tests/Samples/Sample5_UpdateKnowledgeSources.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,8 @@ public void KnowledgeSources()
4646

4747
Operation<Pageable<BinaryData>> updateSourcesOperation = client.UpdateSources(WaitUntil.Completed, testProjectName, updateSourcesRequestContent);
4848

49-
#if SNIPPET
5049
// Updated Knowledge Sources can be retrieved as follows
5150
Pageable<BinaryData> sources = updateSourcesOperation.Value;
52-
#else
53-
// TODO: Remove this condition once https://github.com/Azure/autorest.csharp/issues/2726 is fixed.
54-
Pageable<BinaryData> sources = client.GetSources(testProjectName);
55-
#endif
5651

5752
Console.WriteLine("Sources: ");
5853
foreach (BinaryData source in sources)
@@ -89,13 +84,8 @@ public void KnowledgeSources()
8984

9085
Operation<Pageable<BinaryData>> updateQnasOperation = Client.UpdateQnas(WaitUntil.Completed, testProjectName, updateQnasRequestContent);
9186

92-
#if SNIPPET
9387
// QnAs can be retrieved as follows
9488
Pageable<BinaryData> qnas = updateQnasOperation.Value;
95-
#else
96-
// TODO: Remove this condition once https://github.com/Azure/autorest.csharp/issues/2726 is fixed.
97-
Pageable<BinaryData> qnas = client.GetQnas(testProjectName);
98-
#endif
9989

10090
Console.WriteLine("Qnas: ");
10191
foreach (var qna in qnas)
@@ -201,13 +191,8 @@ public async Task KnowledgeSourcesAsync()
201191

202192
Operation<AsyncPageable<BinaryData>> updateSourcesOperation = await client.UpdateSourcesAsync(WaitUntil.Completed, testProjectName, updateSourcesRequestContent);
203193

204-
#if SNIPPET
205194
// Updated Knowledge Sources can be retrieved as follows
206195
AsyncPageable<BinaryData> sources = updateSourcesOperation.Value;
207-
#else
208-
// TODO: Remove this condition once https://github.com/Azure/autorest.csharp/issues/2726 is fixed.
209-
AsyncPageable<BinaryData> sources = client.GetSourcesAsync(testProjectName);
210-
#endif
211196

212197
Console.WriteLine("Sources: ");
213198
await foreach (BinaryData source in sources)
@@ -243,13 +228,8 @@ public async Task KnowledgeSourcesAsync()
243228

244229
Operation<AsyncPageable<BinaryData>> updateQnasOperation = await Client.UpdateQnasAsync(WaitUntil.Completed, testProjectName, updateQnasRequestContent);
245230

246-
#if SNIPPET
247231
// QnAs can be retrieved as follows
248232
AsyncPageable<BinaryData> qnas = updateQnasOperation.Value;
249-
#else
250-
// TODO: Remove this condition once https://github.com/Azure/autorest.csharp/issues/2726 is fixed.
251-
AsyncPageable<BinaryData> qnas = client.GetQnasAsync(testProjectName);
252-
#endif
253233

254234
Console.WriteLine("Qnas: ");
255235
await foreach (var qna in qnas)

0 commit comments

Comments
 (0)