本文整理汇总了C#中ProfileClient.ListAccounts方法的典型用法代码示例。如果您正苦于以下问题:C# ProfileClient.ListAccounts方法的具体用法?C# ProfileClient.ListAccounts怎么用?C# ProfileClient.ListAccounts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProfileClient
的用法示例。
在下文中一共展示了ProfileClient.ListAccounts方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAzureAccountReturnsAllAccountsWithNullUser
public void GetAzureAccountReturnsAllAccountsWithNullUser()
{
MockDataStore dataStore = new MockDataStore();
ProfileClient.DataStore = dataStore;
ProfileClient client = new ProfileClient();
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
azureSubscription3withoutUser.Account = "test2";
client.Profile.Accounts["test2"] = new AzureAccount
{
Id = "test2",
Type = AzureAccount.AccountType.User,
Properties = new Dictionary<AzureAccount.Property, string>
{
{AzureAccount.Property.Subscriptions, azureSubscription3withoutUser.Id.ToString()}
}
};
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
PowerShellUtilities.GetCurrentModeOverride = () => AzureModule.AzureResourceManager;
var account = client.ListAccounts(null).ToList();
Assert.Equal(2, account.Count);
}
示例2: GetAzureAccountWithoutEnvironmentReturnsAccount
public void GetAzureAccountWithoutEnvironmentReturnsAccount()
{
MockDataStore dataStore = new MockDataStore();
ProfileClient.DataStore = dataStore;
ProfileClient client = new ProfileClient();
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
PowerShellUtilities.GetCurrentModeOverride = () => AzureModule.AzureResourceManager;
var account = client.ListAccounts("test").ToList();
Assert.Equal(1, account.Count);
Assert.Equal("test", account[0].Id);
Assert.Equal(2, account[0].GetSubscriptions(client.Profile).Count);
Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription1.Id));
Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription2.Id));
}
示例3: GetAzureAccountReturnsEmptyEnumerationForNonExistingUser
public void GetAzureAccountReturnsEmptyEnumerationForNonExistingUser()
{
MockDataStore dataStore = new MockDataStore();
ProfileClient.DataStore = dataStore;
ProfileClient client = new ProfileClient();
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
PowerShellUtilities.GetCurrentModeOverride = () => AzureModule.AzureResourceManager;
var account = client.ListAccounts("test2").ToList();
Assert.Equal(1, account.Count);
}
示例4: GetAzureAccountReturnsAllAccountsWithNullUser
public void GetAzureAccountReturnsAllAccountsWithNullUser()
{
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
currentProfile = new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
ProfileClient client = new ProfileClient(currentProfile);
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
azureSubscription3withoutUser.Account = "test2";
client.Profile.Accounts["test2"] = new AzureAccount
{
Id = "test2",
Type = AzureAccount.AccountType.User,
Properties = new Dictionary<AzureAccount.Property, string>
{
{AzureAccount.Property.Subscriptions, azureSubscription3withoutUser.Id.ToString()}
}
};
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
var account = client.ListAccounts(null).ToList();
Assert.Equal(2, account.Count);
}
示例5: GetAzureAccountReturnsEmptyEnumerationForNonExistingUser
public void GetAzureAccountReturnsEmptyEnumerationForNonExistingUser()
{
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
currentProfile = new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
ProfileClient client = new ProfileClient(currentProfile);
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
var account = client.ListAccounts("test2").ToList();
Assert.Equal(0, account.Count);
}
示例6: GetAzureAccountWithoutEnvironmentReturnsAccount
public void GetAzureAccountWithoutEnvironmentReturnsAccount()
{
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
currentProfile = new AzureSMProfile(Path.Combine(AzureSession.ProfileDirectory, AzureSession.ProfileFile));
ProfileClient client = new ProfileClient(currentProfile);
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
var account = client.ListAccounts("test").ToList();
Assert.Equal(1, account.Count);
Assert.Equal("test", account[0].Id);
Assert.Equal(2, account[0].GetSubscriptions(client.Profile).Count);
Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription1.Id));
Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription2.Id));
}
示例7: GetAzureAccountReturnsEmptyEnumerationForNonExistingUser
public void GetAzureAccountReturnsEmptyEnumerationForNonExistingUser()
{
MockDataStore dataStore = new MockDataStore();
ProfileClient.DataStore = dataStore;
ProfileClient client = new ProfileClient();
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
var account = client.ListAccounts("test2").ToList();
Assert.Equal(1, account.Count);
}
示例8: GetAzureAccountWithoutEnvironmentReturnsAccount
public void GetAzureAccountWithoutEnvironmentReturnsAccount()
{
MockDataStore dataStore = new MockDataStore();
ProfileClient.DataStore = dataStore;
ProfileClient client = new ProfileClient();
client.Profile.Subscriptions[azureSubscription1.Id] = azureSubscription1;
client.Profile.Subscriptions[azureSubscription2.Id] = azureSubscription2;
client.Profile.Subscriptions[azureSubscription3withoutUser.Id] = azureSubscription3withoutUser;
client.Profile.Accounts[azureAccount.Id] = azureAccount;
client.Profile.Environments[azureEnvironment.Name] = azureEnvironment;
var account = client.ListAccounts("test").ToList();
Assert.Equal(1, account.Count);
Assert.Equal("test", account[0].Id);
Assert.Equal(2, account[0].GetSubscriptions(client.Profile).Count);
Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription1.Id));
Assert.True(account[0].GetSubscriptions(client.Profile).Any(s => s.Id == azureSubscription2.Id));
}