BTDBTest.InMemoryInMemoryKeyValueDBTest.SimplePrefixWorks C# (CSharp) Method

SimplePrefixWorks() private method

private SimplePrefixWorks ( ) : void
return void
        public void SimplePrefixWorks()
        {
            using (IKeyValueDB db = new InMemoryKeyValueDB())
            {
                using (var tr = db.StartTransaction())
                {
                    tr.CreateKey(_key1);
                    tr.CreateKey(_key2);
                    tr.CreateKey(_key3);
                    Assert.Equal(3, tr.GetKeyValueCount());
                    tr.SetKeyPrefix(ByteBuffer.NewAsync(_key1, 0, 3));
                    Assert.Equal(2, tr.GetKeyValueCount());
                    tr.FindFirstKey();
                    Assert.Equal(new byte[0], tr.GetKeyAsByteArray());
                    tr.FindLastKey();
                    Assert.Equal(_key3.Skip(3).ToArray(), tr.GetKeyAsByteArray());
                    tr.Commit();
                }
            }
        }