Exemplo n.º 1
0
        public async Task UpdateExistingConfigurationTest()
        {
            this.Initialize();
            var keyVaultConfiguration = new KeyVaultConfiguration()
            {
                ADApplicationClientId = "1",
                ADApplicationSecret   = "Secret",
                VaultName             = "test",
                AzureKeyVaultUrl      = @"https://test.vault.azure.net/"
            };

            IKeyVaultConfigurationRepository repository = new KeyVaultConfigurationRepository();
            var isInserted = await repository.InsertOrUpdate(keyVaultConfiguration);

            Assert.IsTrue(isInserted);
            Assert.IsTrue(repository.All.Count() == 1);

            keyVaultConfiguration.ADApplicationSecret = "Updated Secret";
            await repository.InsertOrUpdate(keyVaultConfiguration);

            IKeyVaultConfigurationRepository newRepository = new KeyVaultConfigurationRepository();

            Assert.IsTrue(newRepository.All.Count() == 1);
            Assert.IsTrue(newRepository.All.First().ADApplicationSecret == "Updated Secret");
        }
Exemplo n.º 2
0
        public async Task AddNewConfigurationTest()
        {
            IKeyVaultConfigurationRepository repository = new KeyVaultConfigurationRepository();
            var isInserted = await repository.InsertOrUpdate(MockKeyVaultConfiguration);

            Assert.IsTrue(isInserted);
            Assert.IsTrue(repository.All.Count() == 1);
        }
Exemplo n.º 3
0
        public async Task DeleteExistingConfigurationTest()
        {
            this.Initialize();
            IKeyVaultConfigurationRepository repository = new KeyVaultConfigurationRepository();
            await repository.InsertOrUpdate(MockKeyVaultConfiguration);

            Assert.IsTrue(repository.All.Count() == 1);

            repository.Delete(MockKeyVaultConfiguration);
            Assert.IsTrue(!repository.All.Any());
        }
Exemplo n.º 4
0
        public void DirectoryExistsAfterRepositoryInitializedTest()
        {
            IKeyVaultConfigurationRepository repository = new KeyVaultConfigurationRepository();

            Assert.IsTrue(Directory.Exists(ConfigurationsPath));
        }