Пример #1
0
        public async Task AuthenticateLogicAppManagement_UsingAccessToken_Succeeds()
        {
            // Arrange
            string subscriptionId = Configuration.GetAzureSubscriptionId();
            string accessToken    = Configuration.GetAzureAccessToken();

            var authentication = LogicAppAuthentication.UsingAccessToken(subscriptionId, accessToken);

            // Act
            using (LogicManagementClient managementClient = await authentication.AuthenticateAsync())
            {
                // Assert
                Assert.NotNull(managementClient);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="IntegrationTest"/> class.
        /// </summary>
        protected IntegrationTest(ITestOutputHelper outputWriter)
        {
            Logger               = new XunitTestLogger(outputWriter);
            ResourceGroup        = Configuration.GetAzureResourceGroup();
            LogicAppName         = Configuration.GetTestLogicAppName();
            LogicAppMockingName  = Configuration.GetTestMockingLogicAppName();
            TestBaseLogicAppName = Configuration.GetTestBaseLogicAppName();

            string subscriptionId = Configuration.GetAzureSubscriptionId();
            string tenantId       = Configuration.GetAzureTenantId();
            string clientId       = Configuration.GetAzureClientId();
            string clientSecret   = Configuration.GetAzureClientSecret();

            Authentication = LogicAppAuthentication.UsingServicePrincipal(tenantId, subscriptionId, clientId, clientSecret);
        }
Пример #3
0
        public async Task AuthenticateLogicAppManagement_UsingSecretProvider_Succeeds()
        {
            // Arrange
            string subscriptionId = Configuration.GetAzureSubscriptionId();
            string tenantId       = Configuration.GetAzureTenantId();
            string clientId       = Configuration.GetAzureClientId();
            var    authentication = LogicAppAuthentication.UsingServicePrincipal(tenantId, subscriptionId, clientId, ClientSecretKey, this);

            // Act
            using (LogicManagementClient managementClient = await authentication.AuthenticateAsync())
            {
                // Assert
                Assert.NotNull(managementClient);
            }

            Assert.True(_isClientSecretRequested);
        }
 public void UsingAccessToken_WithBlankAccessToken_Throws(string accessToken)
 {
     Assert.ThrowsAny <ArgumentException>(
         () => LogicAppAuthentication.UsingAccessToken("subscription ID", accessToken));
 }
 public void UsingAccessToken_WithBlankSubscriptionId_Throws(string subscriptionId)
 {
     Assert.ThrowsAny <ArgumentException>(
         () => LogicAppAuthentication.UsingAccessToken(subscriptionId, "access-token"));
 }
 public void UsingServicePrincipalSecretProvider_WithoutSecretProvider_Throws()
 {
     Assert.ThrowsAny <ArgumentException>(
         () => LogicAppAuthentication.UsingServicePrincipal("tenant ID", "subscription ID", "client ID", "client secret key", secretProvider: null));
 }
 public void UsingServicePrincipalSecretProvider_WithBlankClientSecret_Throws(string clientSecret)
 {
     Assert.ThrowsAny <ArgumentException>(
         () => LogicAppAuthentication.UsingServicePrincipal("tenant ID", "subscription ID", "client ID", clientSecret, Mock.Of <ISecretProvider>()));
 }
 public void UsingServicePrincipalSecretProvider_WithSubscriptionId_Throws(string subscriptionId)
 {
     Assert.ThrowsAny <ArgumentException>(
         () => LogicAppAuthentication.UsingServicePrincipal("tenant ID", subscriptionId, "client ID", "client secret", Mock.Of <ISecretProvider>()));
 }
 public void UsingServicePrincipal_WithBlankClientId_Throws(string clientId)
 {
     Assert.ThrowsAny <ArgumentException>(
         () => LogicAppAuthentication.UsingServicePrincipal("tenant Id", "subscription ID", clientId, "client secret"));
 }