本文整理汇总了C#中Microsoft.Azure.Common.Authentication.ProfileClient.RefreshSubscriptions方法的典型用法代码示例。如果您正苦于以下问题:C# ProfileClient.RefreshSubscriptions方法的具体用法?C# ProfileClient.RefreshSubscriptions怎么用?C# ProfileClient.RefreshSubscriptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Azure.Common.Authentication.ProfileClient
的用法示例。
在下文中一共展示了ProfileClient.RefreshSubscriptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshSubscriptionsMergesFromServer
public void RefreshSubscriptionsMergesFromServer()
{
SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList());
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
currentProfile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
ProfileClient client = new ProfileClient(currentProfile);
client.AddOrSetEnvironment(azureEnvironment);
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.AddOrSetSubscription(azureSubscription1);
var subscriptions = client.RefreshSubscriptions(azureEnvironment);
Assert.Equal(4, subscriptions.Count);
Assert.Equal(4, subscriptions.Count(s => s.Account == "test"));
Assert.Equal(1, subscriptions.Count(s => s.Id == azureSubscription1.Id));
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)));
Assert.Equal(2, subscriptions.First(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)).GetPropertyAsArray(AzureSubscription.Property.SupportedModes).Count());
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId)));
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(csmSubscription1.SubscriptionId)));
}
示例2: RefreshSubscriptionsListsAllSubscriptions
public void RefreshSubscriptionsListsAllSubscriptions()
{
SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList());
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
currentProfile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
ProfileClient client = new ProfileClient(currentProfile);
client.AddOrSetAccount(azureAccount);
client.AddOrSetEnvironment(azureEnvironment);
client.AddOrSetSubscription(azureSubscription1);
var subscriptions = client.RefreshSubscriptions(azureEnvironment);
Assert.Equal(4, subscriptions.Count);
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)));
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId)));
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(csmSubscription1.SubscriptionId)));
Assert.True(subscriptions.All(s => s.Environment == "Test"));
Assert.True(subscriptions.All(s => s.Account == "test"));
}
示例3: RefreshSubscriptionsUpdatesAccounts
public void RefreshSubscriptionsUpdatesAccounts()
{
SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList());
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
currentProfile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
ProfileClient client = new ProfileClient(currentProfile);
client.AddOrSetEnvironment(azureEnvironment);
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.AddOrSetSubscription(azureSubscription1);
var subscriptions = client.RefreshSubscriptions(azureEnvironment);
Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(rdfeSubscription1.SubscriptionId)));
Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(rdfeSubscription2.SubscriptionId)));
Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(csmSubscription1.SubscriptionId)));
Assert.True(client.Profile.Accounts[azureAccount.Id].HasSubscription(new Guid(csmSubscription1withDuplicateId.SubscriptionId)));
}
示例4: RefreshSubscriptionsWorksWithMooncake
public void RefreshSubscriptionsWorksWithMooncake()
{
SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1, csmSubscription1withDuplicateId }.ToList());
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
currentProfile = new AzureProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
ProfileClient client = new ProfileClient(currentProfile);
client.Profile.Accounts[azureAccount.Id] = azureAccount;
var subscriptions = client.RefreshSubscriptions(client.Profile.Environments[EnvironmentName.AzureChinaCloud]);
Assert.Equal(3, subscriptions.Count);
Assert.Equal(3, subscriptions.Count(s => s.Account == "test"));
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)));
Assert.Equal(2, subscriptions.First(s => s.Id == new Guid(rdfeSubscription1.SubscriptionId)).GetPropertyAsArray(AzureSubscription.Property.SupportedModes).Count());
Assert.Equal(1, subscriptions.Count(s => s.Id == new Guid(rdfeSubscription2.SubscriptionId)));
}