This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.17k
stars
4.53k
forks
source link
[QUERY] How to mock SubscriptionCollection resources. #44526
I am trying to write a unit test case for the follwing method
public async Task<List<Subscription>> ListSubscriptionsAsync()
{
AsyncPageable<SubscriptionResource> subscriptions = armClient
.GetSubscriptions()
.GetAllAsync();
List<Subscription> subscriptionDataList = new List<Subscription>();
await foreach (SubscriptionResource subscriptionResource in subscriptions)
{
subscriptionDataList.Add(mapper.Map<Subscription>(subscriptionResource.Data));
}
return subscriptionDataList;
}
As part of this i need to create SubscriptionCollection and SubscriptionResource objects and am not able to find public methods that will do this for me. How to handle unit tests in these scenarios?
Library name and version
Azure.ResourceManager
Query/Question
I am trying to write a unit test case for the follwing method
As part of this i need to create SubscriptionCollection and SubscriptionResource objects and am not able to find public methods that will do this for me. How to handle unit tests in these scenarios?
Environment
Environment details:
dotnet version 8 Azure api app