public void ApplicationId_Whitespace_Fails()
        {
            // Arrange
            const string invalidApplicationId  = " ";
            var          validApplicationKey   = Guid.NewGuid().ToString();
            var          inMemoryConfiguration = new Dictionary <string, string>
            {
                { EnvironmentVariables.Authentication.ApplicationId, invalidApplicationId },
                { EnvironmentVariables.Authentication.ApplicationKey, validApplicationKey },
            };
            var config = CreateConfiguration(inMemoryConfiguration);

            // Act
            var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config);
            var validationResult = azureAuthenticationValidationStep.Run();

            // Assert
            Assert.False(validationResult.IsSuccessful);
        }
Пример #2
0
        public void ApplicationKey_EmptyString_Fails()
        {
            // Arrange
            var invalidApplicationId  = Guid.NewGuid().ToString();
            var invalidApplicationKey = string.Empty;
            var inMemoryConfiguration = new Dictionary <string, string>
            {
                { EnvironmentVariables.Authentication.ApplicationId, invalidApplicationId },
                { EnvironmentVariables.Authentication.ApplicationKey, invalidApplicationKey },
            };
            var config = CreateConfiguration(inMemoryConfiguration);

            // Act
            var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger <AzureAuthenticationValidationStep> .Instance);
            var validationResult = azureAuthenticationValidationStep.Run();

            // Assert
            Assert.False(validationResult.IsSuccessful);
        }
        public void ServicePrinciple_IdentityIdInYamlIsEmptyString_Fails()
        {
            // Arrange
            var invalidApplicationId  = string.Empty;
            var validApplicationKey   = Guid.NewGuid().ToString();
            var inMemoryConfiguration = new Dictionary <string, string>
            {
                { EnvironmentVariables.Authentication.ApplicationId, invalidApplicationId },
                { ConfigurationKeys.Authentication.IdentityId, invalidApplicationId },
                { EnvironmentVariables.Authentication.ApplicationKey, validApplicationKey },
            };
            var config = CreateConfiguration(inMemoryConfiguration);

            // Act
            var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger <AzureAuthenticationValidationStep> .Instance);
            var validationResult = azureAuthenticationValidationStep.Run();

            // Assert
            PromitorAssert.ValidationFailed(validationResult);
        }
        public void ServicePrinciple_ApplicationKeyIsValid_Succeeds()
        {
            // Arrange
            var invalidApplicationId  = Guid.NewGuid().ToString();
            var validApplicationKey   = Guid.NewGuid().ToString();
            var inMemoryConfiguration = new Dictionary <string, string>
            {
                { EnvironmentVariables.Authentication.ApplicationId, invalidApplicationId },
                { EnvironmentVariables.Authentication.ApplicationKey, validApplicationKey },
            };

            var config = CreateConfiguration(inMemoryConfiguration);

            // Act
            var azureAuthenticationValidationStep = new AzureAuthenticationValidationStep(config, NullLogger <AzureAuthenticationValidationStep> .Instance);
            var validationResult = azureAuthenticationValidationStep.Run();

            // Assert
            PromitorAssert.ValidationIsSuccessful(validationResult);
        }