I want a unit test with a result of DocumentIntelligenceClient.AnalyzeDocument, which returns Operation, then I need to retrieve AnalyzeResult like below.
var client = new DocumentIntelligenceClient(new Uri(endpoint), new AzureKeyCredential(apiKey));
var content = new AnalyzeDocumentContent()
{
Base64Source = BinaryData.FromBytes(File.ReadAllBytes("table.pdf"))
};
Operation<AnalyzeResult> operation = client.AnalyzeDocument(WaitUntil.Completed, "prebuilt-layout", content);
AnalyzeResult result = operation.Value;
Please note that I don’t need to verify AnalyzeDocument or such, instead I want to test with the AnalyzeResult which contains paragraphs, or tables, or so on.
A problem is that I couldn’t figure out how to create an instance of AnalyzeResult or mock it since its constructor is internal.
https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/documentintelligence/Azure.AI.DocumentIntelligence/src/Generated/AnalyzeResult.cs