Esempio n. 1
0
        public async Task BasicTest()
        {
            IDbStore columnFamilyDbStore = this.rocksDbStoreProvider.GetColumnStoreFamily("test");

            string key   = "key1";
            string value = "value1";

            byte[] keyBytes   = key.ToBytes();
            byte[] valueBytes = value.ToBytes();
            await columnFamilyDbStore.Put(keyBytes, valueBytes);

            Option <byte[]> returnedValueBytesOption = await columnFamilyDbStore.Get(keyBytes);

            Assert.True(returnedValueBytesOption.HasValue);
            byte[] returnedValueBytes = returnedValueBytesOption.OrDefault();
            Assert.True(valueBytes.SequenceEqual(returnedValueBytes));
            Assert.Equal(value, returnedValueBytes.FromBytes());
            Assert.True(await columnFamilyDbStore.Contains(keyBytes));
            Assert.False(await columnFamilyDbStore.Contains("key2".ToBytes()));

            await columnFamilyDbStore.Remove(keyBytes);

            returnedValueBytesOption = await columnFamilyDbStore.Get(keyBytes);

            Assert.False(returnedValueBytesOption.HasValue);
        }