diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/RecognizeCustomFormsLiveTests.cs b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/RecognizeCustomFormsLiveTests.cs index a92e07eecb39..9e8c7a57b7a7 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/RecognizeCustomFormsLiveTests.cs +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/tests/FormRecognizerClient/RecognizeCustomFormsLiveTests.cs @@ -410,9 +410,7 @@ public async Task StartRecognizeCustomFormsWithoutLabels(bool useStream, bool in } [RecordedTest] - [TestCase(true)] - [TestCase(false, Ignore = "https://github.com/Azure/azure-sdk-for-net/issues/12319")] - public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageForm(bool useStream) + public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageForm() { var client = CreateFormRecognizerClient(); var options = new RecognizeCustomFormsOptions() { IncludeFieldElements = true }; @@ -420,18 +418,10 @@ public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageForm(bo await using var trainedModel = await CreateDisposableTrainedModelAsync(useTrainingLabels: false, ContainerType.MultipageFiles); - if (useStream) - { - using var stream = FormRecognizerTestEnvironment.CreateStream(TestFile.InvoiceMultipage); - using (Recording.DisableRequestBodyRecording()) - { - operation = await client.StartRecognizeCustomFormsAsync(trainedModel.ModelId, stream, options); - } - } - else + using var stream = FormRecognizerTestEnvironment.CreateStream(TestFile.InvoiceMultipage); + using (Recording.DisableRequestBodyRecording()) { - var uri = FormRecognizerTestEnvironment.CreateUri(TestFile.InvoiceMultipage); - operation = await client.StartRecognizeCustomFormsFromUriAsync(trainedModel.ModelId, uri, options); + operation = await client.StartRecognizeCustomFormsAsync(trainedModel.ModelId, stream, options); } RecognizedFormCollection recognizedForms = await operation.WaitForCompletionAsync(); @@ -465,6 +455,22 @@ public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageForm(bo Assert.AreEqual("Southridge Video", secondFormFieldInPage.ValueData.Text); } + [RecordedTest] + public async Task StartRecognizeCustomFormsFromUriWithoutLabelsThrowsWithMultipageForm() + { + var client = CreateFormRecognizerClient(); + var options = new RecognizeCustomFormsOptions() { IncludeFieldElements = true }; + + await using var trainedModel = await CreateDisposableTrainedModelAsync(useTrainingLabels: false, ContainerType.MultipageFiles); + + var uri = FormRecognizerTestEnvironment.CreateUri(TestFile.InvoiceMultipage); + var operation = await client.StartRecognizeCustomFormsFromUriAsync(trainedModel.ModelId, uri, options); + + var exception = Assert.ThrowsAsync(async () => await operation.WaitForCompletionAsync()); + + Assert.AreEqual("2002", exception.ErrorCode); + } + [RecordedTest] public async Task StartRecognizeCustomFormsWithoutLabelsCanParseBlankPage() { @@ -500,9 +506,7 @@ public async Task StartRecognizeCustomFormsWithoutLabelsCanParseBlankPage() } [RecordedTest] - [TestCase(true)] - [TestCase(false, Ignore = "https://github.com/Azure/azure-sdk-for-net/issues/12319")] - public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageFormWithBlankPage(bool useStream) + public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageFormWithBlankPage() { var client = CreateFormRecognizerClient(); var options = new RecognizeCustomFormsOptions() { IncludeFieldElements = true }; @@ -510,18 +514,10 @@ public async Task StartRecognizeCustomFormsWithoutLabelsCanParseMultipageFormWit await using var trainedModel = await CreateDisposableTrainedModelAsync(useTrainingLabels: false); - if (useStream) - { - using var stream = FormRecognizerTestEnvironment.CreateStream(TestFile.InvoiceMultipageBlank); - using (Recording.DisableRequestBodyRecording()) - { - operation = await client.StartRecognizeCustomFormsAsync(trainedModel.ModelId, stream, options); - } - } - else + using var stream = FormRecognizerTestEnvironment.CreateStream(TestFile.InvoiceMultipageBlank); + using (Recording.DisableRequestBodyRecording()) { - var uri = FormRecognizerTestEnvironment.CreateUri(TestFile.InvoiceMultipageBlank); - operation = await client.StartRecognizeCustomFormsFromUriAsync(trainedModel.ModelId, uri, options); + operation = await client.StartRecognizeCustomFormsAsync(trainedModel.ModelId, stream, options); } RecognizedFormCollection recognizedForms = await operation.WaitForCompletionAsync();