本文整理汇总了C#中ProfileClient.InitializeProfile方法的典型用法代码示例。如果您正苦于以下问题:C# ProfileClient.InitializeProfile方法的具体用法?C# ProfileClient.InitializeProfile怎么用?C# ProfileClient.InitializeProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProfileClient
的用法示例。
在下文中一共展示了ProfileClient.InitializeProfile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewProfileFromCertificateWithNullsThrowsArgumentNullException
public void NewProfileFromCertificateWithNullsThrowsArgumentNullException()
{
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
AzureSMProfile newProfile = new AzureSMProfile();
ProfileClient client1 = new ProfileClient(newProfile);
Assert.Throws<ArgumentNullException>(() =>
client1.InitializeProfile(null, Guid.NewGuid(), new X509Certificate2(), "foo"));
Assert.Throws<ArgumentNullException>(() =>
client1.InitializeProfile(AzureEnvironment.PublicEnvironments["AzureCloud"], Guid.NewGuid(), null, "foo"));
}
示例2: NewProfileFromCertificateReturnsProfile
public void NewProfileFromCertificateReturnsProfile()
{
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
AzureSMProfile newProfile = new AzureSMProfile();
ProfileClient client1 = new ProfileClient(newProfile);
var subscriptionId = Guid.NewGuid();
var certificate = new X509Certificate2(Convert.FromBase64String(dummyCertificate));
client1.InitializeProfile(AzureEnvironment.PublicEnvironments["AzureCloud"],
subscriptionId, certificate, null);
Assert.Equal("AzureCloud", newProfile.DefaultSubscription.Environment);
Assert.Equal(subscriptionId, newProfile.DefaultSubscription.Id);
Assert.Equal(certificate.Thumbprint, newProfile.DefaultSubscription.Account);
Assert.False(newProfile.DefaultSubscription.Properties.ContainsKey(AzureSubscription.Property.StorageAccount));
}
示例3: NewProfileFromADWithMismatchSubscriptionThrows
public void NewProfileFromADWithMismatchSubscriptionThrows()
{
SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1 }.ToList());
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
AzureSMProfile newProfile = new AzureSMProfile();
ProfileClient client1 = new ProfileClient(newProfile);
var newAccount = new AzureAccount { Id = "foo" };
newAccount.Properties[AzureAccount.Property.Tenants] = "123";
Assert.Throws<ArgumentException>(() => client1.InitializeProfile(AzureEnvironment.PublicEnvironments["AzureCloud"],
Guid.NewGuid(), newAccount, null, null));
}
示例4: NewProfileWithAccessTokenReturnsProfile
public void NewProfileWithAccessTokenReturnsProfile()
{
//SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new[] { csmSubscription1 }.ToList());
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
AzureSMProfile newProfile = new AzureSMProfile();
ProfileClient client1 = new ProfileClient(newProfile);
client1.InitializeProfile(AzureEnvironment.PublicEnvironments["AzureCloud"],
new Guid(csmSubscription1.SubscriptionId), "accessToken", "accountId", null);
Assert.Equal("AzureCloud", newProfile.DefaultSubscription.Environment);
Assert.Equal(new Guid(csmSubscription1.SubscriptionId), newProfile.DefaultSubscription.Id);
Assert.Equal("accountId", newProfile.DefaultSubscription.Account);
Assert.Equal(AzureAccount.AccountType.AccessToken, newProfile.Context.Account.Type);
Assert.Equal("accessToken", newProfile.Context.Account.Properties[AzureAccount.Property.AccessToken]);
Assert.False(newProfile.DefaultSubscription.Properties.ContainsKey(AzureSubscription.Property.StorageAccount));
}
示例5: NewProfileFromADReturnsProfile
public void NewProfileFromADReturnsProfile()
{
SetMocks(new[] { rdfeSubscription1, rdfeSubscription2 }.ToList(), new List<CSMSubscription>());
rdfeSubscription2.ActiveDirectoryTenantId = "123";
MemoryDataStore dataStore = new MemoryDataStore();
AzureSession.DataStore = dataStore;
AzureSMProfile newProfile = new AzureSMProfile();
ProfileClient client1 = new ProfileClient(newProfile);
var newAccount = new AzureAccount { Id = "foo" };
newAccount.Properties[AzureAccount.Property.Tenants] = "123";
client1.InitializeProfile(AzureEnvironment.PublicEnvironments["AzureCloud"],
new Guid(rdfeSubscription2.SubscriptionId), newAccount, null, null);
Assert.Equal("AzureCloud", newProfile.DefaultSubscription.Environment);
Assert.Equal(new Guid(rdfeSubscription2.SubscriptionId), newProfile.DefaultSubscription.Id);
Assert.Equal(newAccount.Id, newProfile.DefaultSubscription.Account);
Assert.False(newProfile.DefaultSubscription.Properties.ContainsKey(AzureSubscription.Property.StorageAccount));
}