public void MoreComplexTransaction()
{
using (var fileCollection = new InMemoryFileCollection())
using (IKeyValueDB db = new KeyValueDB(fileCollection))
{
using (var tr = db.StartTransaction())
{
Assert.True(tr.CreateOrUpdateKeyValue(ByteBuffer.NewAsync(_key1), ByteBuffer.NewAsync(new byte[0])));
Assert.False(tr.CreateOrUpdateKeyValue(ByteBuffer.NewAsync(_key1), ByteBuffer.NewAsync(new byte[0])));
Assert.Equal(FindResult.Previous, tr.Find(ByteBuffer.NewAsync(Key2)));
Assert.True(tr.CreateOrUpdateKeyValue(ByteBuffer.NewAsync(Key2), ByteBuffer.NewAsync(new byte[0])));
Assert.Equal(FindResult.Exact, tr.Find(ByteBuffer.NewAsync(_key1)));
Assert.Equal(FindResult.Exact, tr.Find(ByteBuffer.NewAsync(Key2)));
Assert.Equal(FindResult.Previous, tr.Find(ByteBuffer.NewAsync(_key3)));
Assert.Equal(FindResult.Next, tr.Find(ByteBuffer.NewEmpty()));
tr.Commit();
}
}
}