BTDBTest.KeyValueDBTest.CompactionDoesNotRemoveStillUsedFiles C# (CSharp) Method

CompactionDoesNotRemoveStillUsedFiles() private method

private CompactionDoesNotRemoveStillUsedFiles ( ) : void
return void
        public void CompactionDoesNotRemoveStillUsedFiles()
        {
            using (var fileCollection = new InMemoryFileCollection())
            {
                using (var db = new KeyValueDB(fileCollection, new NoCompressionStrategy(), 1024, null))
                {
                    using (var tr = db.StartTransaction())
                    {
                        tr.CreateOrUpdateKeyValue(_key1, new byte[1024]);
                        tr.CreateOrUpdateKeyValue(Key2, new byte[10]);
                        tr.Commit();
                    }
                    var longTr = db.StartTransaction();
                    using (var tr = db.StartTransaction())
                    {
                        tr.FindExactKey(_key1);
                        tr.EraseCurrent();
                        tr.Commit();
                    }
                    db.Compact(new CancellationToken());
                    Assert.Equal(3u, fileCollection.GetCount()); // 2 Logs, 1 KeyIndex
                    longTr.Dispose();
                    db.Compact(new CancellationToken());
                    Assert.Equal(2u, fileCollection.GetCount()); // 1 Log, 1 KeyIndex
                    using (var tr = db.StartTransaction())
                    {
                        tr.CreateOrUpdateKeyValue(_key3, new byte[10]);
                        tr.Commit();
                    }
                    using (var db2 = new KeyValueDB(fileCollection, new NoCompressionStrategy(), 1024))
                    {
                        using (var tr = db2.StartTransaction())
                        {
                            Assert.True(tr.FindExactKey(_key3));
                        }
                    }
                }
            }
        }