public void ActiveDirectoryIntegratedValidTest() { var provider = AzureServiceTokenProviderFactory.Create(Constants.ActiveDirectoryIntegratedConnectionString, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.ActiveDirectoryIntegratedConnectionString, provider.ConnectionString); }
public void CertValidTest() { var provider = AzureServiceTokenProviderFactory.Create(Constants.CertificateConnStringThumbprintLocalMachine, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.CertificateConnStringThumbprintLocalMachine, provider.ConnectionString); Assert.IsType <ClientCertificateAzureServiceTokenProvider>(provider); provider = AzureServiceTokenProviderFactory.Create(Constants.CertificateConnStringThumbprintCurrentUser, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.CertificateConnStringThumbprintCurrentUser, provider.ConnectionString); Assert.IsType <ClientCertificateAzureServiceTokenProvider>(provider); provider = AzureServiceTokenProviderFactory.Create(Constants.CertificateConnStringSubjectNameCurrentUser, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.CertificateConnStringSubjectNameCurrentUser, provider.ConnectionString); Assert.IsType <ClientCertificateAzureServiceTokenProvider>(provider); provider = AzureServiceTokenProviderFactory.Create(Constants.CertificateConnStringKeyVaultCertificateSecretIdentifier, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.CertificateConnStringKeyVaultCertificateSecretIdentifier, provider.ConnectionString); Assert.IsType <ClientCertificateAzureServiceTokenProvider>(provider); provider = AzureServiceTokenProviderFactory.Create(Constants.CertificateConnStringKeyVaultCertificateSecretIdentifierUserAssignedMsi, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.CertificateConnStringKeyVaultCertificateSecretIdentifierUserAssignedMsi, provider.ConnectionString); Assert.IsType <ClientCertificateAzureServiceTokenProvider>(provider); provider = AzureServiceTokenProviderFactory.Create(Constants.CertificateConnStringKeyVaultCertificateSecretIdentifierWithOptionalTenantId, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.CertificateConnStringKeyVaultCertificateSecretIdentifierWithOptionalTenantId, provider.ConnectionString); Assert.IsType <ClientCertificateAzureServiceTokenProvider>(provider); }
public void ClientSecretValidTest() { var provider = AzureServiceTokenProviderFactory.Create(Constants.ClientSecretConnString, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.ClientSecretConnString, provider.ConnectionString); Assert.IsType <ClientSecretAccessTokenProvider>(provider); }
public void ManagedUserAssignedIdentityValidTest() { var provider = AzureServiceTokenProviderFactory.Create(Constants.ManagedUserAssignedIdentityConnectionString, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.ManagedUserAssignedIdentityConnectionString, provider.ConnectionString); Assert.IsType <MsiAccessTokenProvider>(provider); }
public void AzureCliConnectionStringEndsWithSpaceTest() { var provider = AzureServiceTokenProviderFactory.Create(Constants.AzureCliConnectionStringEndingWithSemiColonAndSpace, Constants.AzureAdInstance); Assert.NotNull(provider); Assert.Equal(Constants.AzureCliConnectionStringEndingWithSemiColonAndSpace, provider.ConnectionString); Assert.IsType <AzureCliAccessTokenProvider>(provider); }
public void AzureCliConnectionStringNullOrEmptyTest() { var exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(null, Constants.AzureAdInstance)); Assert.Contains(Constants.ConnectionStringEmpty, exception.ToString()); exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(string.Empty, Constants.AzureAdInstance)); Assert.Contains(Constants.ConnectionStringEmpty, exception.ToString()); }
public void AzureCliInvalidConnectionStringTest() { var exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(Constants.AzureCliConnectionStringNoRunAs, Constants.AzureAdInstance)); Assert.Contains(Constants.InvalidConnectionString, exception.ToString()); exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(Constants.AzureCliConnectionStringWithEmptyDeveloperTool, Constants.AzureAdInstance)); Assert.Contains(Constants.InvalidConnectionString, exception.ToString()); }
public void AzureCliIncorrectFormatConnectionStringTest() { var exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(Constants.IncorrectFormatConnectionString, Constants.AzureAdInstance)); Assert.Contains(Constants.NotInProperFormatError, exception.ToString()); }
public void AzureCliRepeatedKeyConnectionStringTest() { var exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(Constants.AzureCliConnectionStringRepeatedRunAs, Constants.AzureAdInstance)); Assert.Contains(Constants.KeyRepeatedInConnectionString, exception.ToString()); }
public void ActiveDirectoryNotSupportedInNetCoreTest() { var exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(Constants.ActiveDirectoryIntegratedConnectionString, Constants.AzureAdInstance)); Assert.Contains(Constants.NotSupportedInNetCoreError, exception.ToString()); }
public void AzureCliConnectionStringInvalidCertLocationTest() { var exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(Constants.CertificateConnStringThumbprintInvalidLocation, Constants.AzureAdInstance)); Assert.Contains(Constants.InvalidCertLocationError, exception.ToString()); }
public void AzureCliConnectionStringNoCertLocationOrAppKeyTest() { var exception = Assert.Throws <ArgumentException>(() => AzureServiceTokenProviderFactory.Create(Constants.AppConnStringNoLocationOrAppKey, Constants.AzureAdInstance)); Assert.Contains(Constants.ConnectionStringMissingCertLocation, exception.ToString()); }