Azure-sdk-for-net: Add Abstractions to FormRecognizer to allow for easier Mocking

Created on 5 Aug 2020  路  2Comments  路  Source: Azure/azure-sdk-for-net

Library or service name.
What library or service is this request related to?
Azure.AI.FormRecognizer

Is your feature request related to a problem? Please describe.
What feature would you like to get added? What problem is it solving?

I am writing a service that consumes the FormRecognizer. In order to test my class that consumes the FormRecognizerClient I am attempting to Mock the dependencies. This includes the FormRecognizerClient and calls to .WaitForCompletionAsync() to return a RecognizedFormCollection object with a test RecognizedForm object and test data. I am finding it difficult to achieve this as there are no Interfaces available and many of the classes only have internal constructors (RecognizedForm, pageResult etc). Please could you provide Interfaces etc to assist in the abstraction of the FormRecognizer and aid testing of code that consumes this?

Client Cognitive - Form Recognizer customer-reported needs-team-attention question

Most helpful comment

Thanks @jsquire .
That is correct. We are working on adding a model factory that will facilitate your work @lenniebriscoe .
Please follow issue https://github.com/Azure/azure-sdk-for-net/issues/11529 for status updates.

I will close this one as a dup of https://github.com/Azure/azure-sdk-for-net/issues/11529

All 2 comments

Hi @lenniebriscoe. Thank you for sharing your feedback and we regret that you're experiencing difficulties. The ability to mock the Azure SDK libraries is a core priority for us. Typically, mocking for model types would be done using a dedicated model factory, which our guidelines describe.

Because the Form Recognizer library is still in preview, it looks as if mocking support hasn't yet been added in. This appears to be tracked in #11529. I'll defer to @annelo-msft as the authoritative voice for Form Recognizer to confirm or add additional thoughts.

Thanks @jsquire .
That is correct. We are working on adding a model factory that will facilitate your work @lenniebriscoe .
Please follow issue https://github.com/Azure/azure-sdk-for-net/issues/11529 for status updates.

I will close this one as a dup of https://github.com/Azure/azure-sdk-for-net/issues/11529

Was this page helpful?
0 / 5 - 0 ratings