public void Build_can_create_a_IConfigurationProvider_with_options(SecretsManagerConfigurationProviderOptions options, IConfigurationBuilder configurationBuilder)
        {
            var sut = new SecretsManagerConfigurationSource(options: options);

            var provider = sut.Build(configurationBuilder);

            Assert.That(provider, Is.Not.Null);
            Assert.That(provider, Is.InstanceOf <SecretsManagerConfigurationProvider>());
        }
        public void Build_can_create_a_IConfigurationProvider_with_credentials(AWSCredentials credentials, IConfigurationBuilder configurationBuilder)
        {
            var sut = new SecretsManagerConfigurationSource(credentials);

            var provider = sut.Build(configurationBuilder);

            Assert.That(provider, Is.Not.Null);
            Assert.That(provider, Is.InstanceOf <SecretsManagerConfigurationProvider>());
        }
Ejemplo n.º 3
0
        public void Build_uses_given_client_factory_method(IConfigurationBuilder configurationBuilder, SecretsManagerConfigurationProviderOptions options, Func <IAmazonSecretsManager> clientFactory)
        {
            options.CreateClient = clientFactory;

            var sut = new SecretsManagerConfigurationSource(options: options);

            var provider = sut.Build(configurationBuilder);

            Assert.That(provider, Is.Not.Null);
            Mock.Get(clientFactory).Verify(p => p());
        }
Ejemplo n.º 4
0
        public void Build_invokes_config_client_method(IConfigurationBuilder configurationBuilder, Action <AmazonSecretsManagerConfig> secretsManagerConfiguration)
        {
            var options = new SecretsManagerConfigurationProviderOptions
            {
                ConfigureSecretsManagerConfig = secretsManagerConfiguration
            };

            var sut = new SecretsManagerConfigurationSource(options: options);

            var provider = sut.Build(configurationBuilder);

            Mock.Get(secretsManagerConfiguration).Verify(p => p(It.Is <AmazonSecretsManagerConfig>(c => c != null)), Times.Once());
        }
Ejemplo n.º 5
0
        public void Build_invokes_config_client_method(IConfigurationBuilder configurationBuilder)
        {
            bool configInvoked = false;
            AmazonSecretsManagerConfig usedConfig = null;
            var sut = new SecretsManagerConfigurationSource(options: new SecretsManagerConfigurationProviderOptions()
            {
                ConfigureSecretsManagerConfig = c =>
                {
                    usedConfig    = c;
                    configInvoked = true;
                }
            });


            var provider = sut.Build(configurationBuilder);

            Assert.That(configInvoked, Is.True);
            Assert.That(usedConfig, Is.Not.Null);
        }