Skip to content

Commit

Permalink
adjust tests and re record (#22065)
Browse files Browse the repository at this point in the history
  • Loading branch information
maririos authored Jun 22, 2021
1 parent 09df25a commit 42039d1
Show file tree
Hide file tree
Showing 8 changed files with 446 additions and 1,035 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ public async Task StartRecognizeCustomFormsThrowsForDamagedFile(bool useTraining
/// Recognizer cognitive service and handle returned errors.
/// </summary>
[RecordedTest]
[TestCase(true, Ignore = "https://github.com/Azure/azure-sdk-for-net/issues/20961")]
[TestCase(true)]
[TestCase(false)]
public async Task StartRecognizeCustomFormsFromUriThrowsForNonExistingContent(bool useTrainingLabels)
{
Expand All @@ -598,13 +598,9 @@ public async Task StartRecognizeCustomFormsFromUriThrowsForNonExistingContent(bo

await using var trainedModel = await CreateDisposableTrainedModelAsync(useTrainingLabels);

var operation = await client.StartRecognizeCustomFormsFromUriAsync(trainedModel.ModelId, invalidUri);

RequestFailedException ex = Assert.ThrowsAsync<RequestFailedException>(async () => await operation.WaitForCompletionAsync());
RequestFailedException ex = Assert.ThrowsAsync<RequestFailedException>(async () => await client.StartRecognizeCustomFormsFromUriAsync(trainedModel.ModelId, invalidUri));

Assert.AreEqual("2003", ex.ErrorCode);
Assert.True(operation.HasCompleted);
Assert.False(operation.HasValue);
Assert.AreEqual("2001", ex.ErrorCode);
}

[RecordedTest]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,14 @@ public async Task StartTrainingWithNoLabelsModelName()
}

[RecordedTest]
public async Task StartTrainingError()
public void StartTrainingError()
{
var client = CreateFormTrainingClient();

var containerUrl = new Uri("https://someUrl");

TrainingOperation operation = await client.StartTrainingAsync(containerUrl, useTrainingLabels: false);
RequestFailedException ex = Assert.ThrowsAsync<RequestFailedException>(async () => await operation.WaitForCompletionAsync());
Assert.AreEqual("2001", ex.ErrorCode);

Assert.False(operation.HasValue);
Assert.Throws<RequestFailedException>(() => operation.Value.GetType());
RequestFailedException ex = Assert.ThrowsAsync<RequestFailedException>(async () => await client.StartTrainingAsync(containerUrl, useTrainingLabels: false));
Assert.AreEqual("2011", ex.ErrorCode);
}

[RecordedTest]
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 42039d1

Please sign in to comment.