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