当前位置: 首页>>代码示例>>C#>>正文


C# ProfileClient.InitializeProfile方法代码示例

本文整理汇总了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"));
 }
开发者ID:rohmano,项目名称:azure-powershell,代码行数:11,代码来源:ProfileClientTests.cs

示例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));
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:17,代码来源:ProfileClientTests.cs

示例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));
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:13,代码来源:ProfileClientTests.cs

示例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));
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:18,代码来源:ProfileClientTests.cs

示例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));
        }
开发者ID:Azure,项目名称:azure-powershell,代码行数:19,代码来源:ProfileClientTests.cs


注:本文中的ProfileClient.InitializeProfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。