Beispiel #1
0
        public void Can_create_keyfiles()
        {
            string folder = GetFolder("Create");

            TestHelper.DeleteFolder(folder);
            var manager = new VaultManager(folder);

            manager.CreateKeyFiles();
        }
Beispiel #2
0
        public void Can_tell_if_publickey_does_exist()
        {
            string folder  = GetFolder("Public");
            var    manager = new VaultManager(folder);

            manager.CreateKeyFiles(true);
            var reader = new VaultReader(folder);

            var publicKeyExists = reader.PublicKeyExists;

            Assert.True(publicKeyExists);
        }
Beispiel #3
0
        public void Can_set_key()
        {
            var folder  = GetFolder("SetKey");
            var manager = new VaultManager(folder);

            manager.CreateKeyFiles(true);
            string key   = TestHelper.GenerateValue();
            string value = TestHelper.GenerateValue();

            manager.SetValue(key, value);

            var reader = new VaultReader(folder);

            Assert.Equal(value, reader[key]);
        }
Beispiel #4
0
        public void Can_read_value()
        {
            string folder  = GetFolder("Keys");
            var    manager = new VaultManager(folder);

            manager.CreateKeyFiles(true);
            var key   = TestHelper.GenerateValue();
            var value = TestHelper.GenerateValue();

            manager.SetValue(key, value);
            var reader = new VaultReader(folder);

            var content = reader[key];

            Assert.Equal(value, content);
        }
Beispiel #5
0
        public void Can_delete_key()
        {
            var folder  = GetFolder("DeleteKey");
            var manager = new VaultManager(folder);

            manager.CreateKeyFiles(true);
            string key   = TestHelper.GenerateValue();
            string value = TestHelper.GenerateValue();

            manager.SetValue(key, value);

            manager.Delete(key);

            var reader = new VaultReader(folder);

            Assert.True(reader[key] == null);
        }
Beispiel #6
0
        public void Can_access_all_keys()
        {
            string folder  = GetFolder("Keys");
            var    manager = new VaultManager(folder);

            manager.CreateKeyFiles(true);
            var key1  = TestHelper.GenerateValue();
            var key2  = TestHelper.GenerateValue();
            var value = TestHelper.GenerateValue();

            manager.SetValue(key1, value);
            manager.SetValue(key2, value);
            var reader = new VaultReader(folder);

            var keys = reader.Keys.ToHashSet();

            Assert.Contains(key1, keys);
            Assert.Contains(key2, keys);
        }
Beispiel #7
0
        public void Can_update_keyfiles()
        {
            var manager = new VaultManager(GetFolder("Update"));

            manager.CreateKeyFiles(true);
        }