Skip to content

Commit

Permalink
Add addtional properties and integrate common lib of 1.3.39
Browse files Browse the repository at this point in the history
  • Loading branch information
msJinLei committed Jun 29, 2021
1 parent 4c31073 commit 1bfea57
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 80 deletions.
16 changes: 8 additions & 8 deletions src/Accounts/Accounts.Test/AzureRMProfileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static RMProfileClient SetupTestEnvironment(List<string> tenants, params
var clientFactory = new MockSubscriptionClientFactory(tenants, subscriptionList);
var mock = new MockClientFactory(new List<object>
{
clientFactory.GetSubscriptionClientVer2019(),
clientFactory.GetSubscriptionClientVerLatest(),
clientFactory.GetSubscriptionClientVer2016()
}, true);
mock.MoqClients = true;
Expand Down Expand Up @@ -90,7 +90,7 @@ private static AzureRmProfile SetupLogin(List<string> tenants, params List<strin
var clientFactory = new MockSubscriptionClientFactory(tenants, subscriptionList);
var mock = new MockClientFactory(new List<object>
{
clientFactory.GetSubscriptionClientVer2019(),
clientFactory.GetSubscriptionClientVerLatest(),
clientFactory.GetSubscriptionClientVer2016()
}, true);
mock.MoqClients = true;
Expand Down Expand Up @@ -164,8 +164,8 @@ public void SubscriptionIdNotExist()
TenantId = DefaultTenant.ToString()
};

MockSubscriptionClientFactory.SubGetQueueVer2019 = new Queue<Func<AzureOperationResponse<Subscription>>>();
MockSubscriptionClientFactory.SubGetQueueVer2019.Enqueue(() =>
MockSubscriptionClientFactory.SubGetQueueVerLatest = new Queue<Func<AzureOperationResponse<Subscription>>>();
MockSubscriptionClientFactory.SubGetQueueVerLatest.Enqueue(() =>
{
throw new CloudException("InvalidAuthenticationTokenTenant: The access token is from the wrong issuer");
});
Expand Down Expand Up @@ -230,8 +230,8 @@ public void SubscriptionIdNotInFirstTenant()
TenantId = DefaultTenant.ToString()
};

MockSubscriptionClientFactory.SubGetQueueVer2019 = new Queue<Func<AzureOperationResponse<Subscription>>>();
MockSubscriptionClientFactory.SubGetQueueVer2019.Enqueue(() =>
MockSubscriptionClientFactory.SubGetQueueVerLatest = new Queue<Func<AzureOperationResponse<Subscription>>>();
MockSubscriptionClientFactory.SubGetQueueVerLatest.Enqueue(() =>
{
throw new CloudException("InvalidAuthenticationTokenTenant: The access token is from the wrong issuer");
});
Expand Down Expand Up @@ -266,8 +266,8 @@ public void SubscriptionNameNotInFirstTenant()
TenantId = DefaultTenant.ToString()
};

MockSubscriptionClientFactory.SubListQueueVer2019 = new Queue<Func<AzureOperationResponse<IPage<Subscription>>>>();
MockSubscriptionClientFactory.SubListQueueVer2019.Enqueue(() =>
MockSubscriptionClientFactory.SubListQueueVerLatest = new Queue<Func<AzureOperationResponse<IPage<Subscription>>>>();
MockSubscriptionClientFactory.SubListQueueVerLatest.Enqueue(() =>
{
var sub1 = new Subscription(
id: DefaultSubscription.ToString(),
Expand Down
26 changes: 13 additions & 13 deletions src/Accounts/Accounts.Test/AzureRMProfileTestsForMultitenant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public void LoginByTenant()

Dictionary<string, string> subscriptionList = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
null
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionList.Values.ToList())
Expand Down Expand Up @@ -320,7 +320,7 @@ public void LoginBySubscriptionInMultitenantsHomeFirst()
var subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
var subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
MockSubscriptionClientFactory.CreateTenantListFromJson(GetTenantsJson(tenantA, tenantB).Values.ToArray())
, MockSubscriptionClientFactory.CreateSubscripitonsFromJson(subscriptionListA[subscriptionA], subscriptionListB[subscriptionA])
, null
Expand Down Expand Up @@ -364,7 +364,7 @@ public void LoginBySubscriptionInMultitenantsHomeSecond()
var subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
var subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
MockSubscriptionClientFactory.CreateTenantListFromJson(tenantList[tenantB], tenantList[tenantA])
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListB.Values.ToList(), subscriptionListA.Values.ToList())
Expand Down Expand Up @@ -409,7 +409,7 @@ public void LoginBySubscriptionInManagedByTenants()
Dictionary<string, string> subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
Dictionary<string, string> subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
MockSubscriptionClientFactory.CreateTenantListFromJson(GetTenantsJson(tenantA, tenantB).Values.ToArray())
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListA.Values.ToList(), subscriptionListB.Values.ToList())
Expand Down Expand Up @@ -452,7 +452,7 @@ public void LoginBySubscriptionTenant()

Dictionary<string, string> subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
null
, MockSubscriptionClientFactory.CreateSubscripitonsFromJson(subscriptionListA[subscriptionB])
, null
Expand Down Expand Up @@ -496,7 +496,7 @@ public void LoginByTenantSubscriptionNotExist()
Dictionary<string, string> subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
Dictionary<string, string> subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
null
, MockSubscriptionClientFactory.CreateSubscripitonsFromJson(null)
, null
Expand Down Expand Up @@ -537,7 +537,7 @@ public void LoginSubscriptionNameNotExist()
Dictionary<string, string> subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
Dictionary<string, string> subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
MockSubscriptionClientFactory.CreateTenantListFromJson(GetTenantsJson(tenantA, tenantB).Values.ToArray())
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListA.Values.ToList(), subscriptionListB.Values.ToList())
Expand Down Expand Up @@ -574,7 +574,7 @@ public void SetContextByValidTenant()

Dictionary<string, string> subscriptionList = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
null
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionList.Values.ToList())
Expand Down Expand Up @@ -611,7 +611,7 @@ public void SetContextBySubscriptionIdInHomeTenant()
var subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
var subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
MockSubscriptionClientFactory.CreateTenantListFromJson(GetTenantsJson(tenantA, tenantB).Values.ToArray())
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListB.Values.ToList(), subscriptionListA.Values.ToList())
Expand Down Expand Up @@ -647,7 +647,7 @@ public void SetContextBySubscriptionNameInHomeTenant()
var subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
var subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
MockSubscriptionClientFactory.CreateTenantListFromJson(tenantList[tenantB], tenantList[tenantA])
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListA.Values.ToList(), subscriptionListB.Values.ToList())
Expand Down Expand Up @@ -683,7 +683,7 @@ public void SetContextBySubscriptionInManagedByTenants()
Dictionary<string, string> subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
Dictionary<string, string> subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
MockSubscriptionClientFactory.CreateTenantListFromJson(GetTenantsJson(tenantA, tenantB).Values.ToArray())
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListA.Values.ToList(), subscriptionListB.Values.ToList())
Expand Down Expand Up @@ -717,7 +717,7 @@ public void SetContextBySubscriptionTenant()

Dictionary<string, string> subscriptionListA = GetFirstTenantSubscriptionsJson(tenantA, subscriptionA, subscriptionB, subscriptionC, tenantB);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
null
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListA.Values.ToList())
Expand Down Expand Up @@ -752,7 +752,7 @@ public void SetContextBySubscriptionTenantNotExist()

Dictionary<string, string> subscriptionListB = GetSecondTenantSubscriptionsJson(tenantB, subscriptionA, subscriptionB, subscriptionC, subscriptionD, tenantA);
subscriptionClients.Clear();
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVer2019(
subscriptionClients.Enqueue(clientFactory.GetSubscriptionClientVerLatest(
null
, null
, MockSubscriptionClientFactory.CreateSubscriptionListsFromJson(subscriptionListB.Values.ToList())
Expand Down
Loading

0 comments on commit 1bfea57

Please sign in to comment.