Open Gamecock opened 7 months ago
Just to clarify, are you asking for this class to be mockable in the context of unit tests in your project that uses this SDK?
If so, I'd recommend adding an IQuery interface for the provisioningServiceClient.CreateEnrollmentGroupQuery
and provisioningServiceClient.CreateEnrollmentGroupRegistrationStateQuery
and provisioningServiceClient.CreateIndividualEnrollmentQuery
to return instead of the concrete class Query
they currently return. The interface will need to match the Query
so it would look something like
public interface IQuery : IDisposable
{
public int PageSize { get; set; }
public string ContinuationToken { get; set; }
public bool HasNext();
public async Task<QueryResult> NextAsync(string continuationToken);
public async Task<QueryResult> NextAsync();
}
Once that is checked into this repo, you should be able to make your provisioning service client return a mocked IQuery object that you have full control over.
Thanks, that what I was looking for.
https://github.com/Azure/azure-iot-sdk-csharp/blob/main/provisioning/service/src/Config/QueryResult.cs
The QueryResponseClass needs to be modifiable to allow testing of applications that query the DPS.
I'm happy to do the work, just looking for guidance on how you would like to proceed.