Exemplo n.º 1
0
        public byte[] NewRandomKey()
        {
            byte[] randomKey;
            do
            {
                randomKey = Random.NextBytes(PreStoredDataKeySize);
            }while (KeyValueStore.Exists(randomKey));

            return(randomKey);
        }
Exemplo n.º 2
0
        public KeyBytes NewRandomKey()
        {
            KeyBytes randomKey;

            do
            {
                randomKey = new KeyBytes(Random.NextBytes(PreStoredDataKeySize));
            }while (KeyValueStore.Exists(randomKey));

            return(randomKey);
        }
Exemplo n.º 3
0
        public void Exists()
        {
            foreach (var(key, _) in PreStoredDataKeys.Zip(PreStoredDataValues, ValueTuple.Create))
            {
                Assert.True(KeyValueStore.Exists(key));
            }

            var randomKey = NewRandomKey();

            Assert.False(KeyValueStore.Exists(randomKey));
        }
Exemplo n.º 4
0
 public void DeleteMany()
 {
     KeyBytes[] nonExistentKeys = Enumerable.Range(0, 10)
                                  .Select(_ => NewRandomKey())
                                  .ToArray();
     KeyBytes[] keys = PreStoredDataKeys
                       .Concat(PreStoredDataKeys.Take(PreStoredDataCount / 2))
                       .Concat(nonExistentKeys)
                       .ToArray();
     KeyValueStore.Delete(keys);
     Assert.All(keys, k => Assert.False(KeyValueStore.Exists(k)));
 }
Exemplo n.º 5
0
        public void Delete()
        {
            foreach (KeyBytes key in PreStoredDataKeys)
            {
                KeyValueStore.Delete(key);
                Assert.False(KeyValueStore.Exists(key));
            }

            KeyBytes nonExistent = NewRandomKey();

            KeyValueStore.Delete(nonExistent);
            Assert.False(KeyValueStore.Exists(nonExistent));
        }