public void MultipleTransactions(int transactionCount)
{
using (var fileCollection = new InMemoryFileCollection())
using (IKeyValueDB db = new KeyValueDB(fileCollection))
{
var key = new byte[2 + transactionCount * 10];
for (int i = 0; i < transactionCount; i++)
{
key[0] = (byte)(i / 256);
key[1] = (byte)(i % 256);
using (var tr1 = db.StartTransaction())
{
tr1.CreateOrUpdateKeyValue(ByteBuffer.NewSync(key, 0, 2 + i * 10), ByteBuffer.NewEmpty());
if (i % 100 == 0 || i == transactionCount - 1)
{
for (int j = 0; j < i; j++)
{
key[0] = (byte)(j / 256);
key[1] = (byte)(j % 256);
Assert.Equal(FindResult.Exact, tr1.Find(ByteBuffer.NewSync(key, 0, 2 + j * 10)));
}
}
tr1.Commit();
}
}
}
}