public virtual void TestRAMDirectorySize()
{
Directory dir = NewFSDirectory(IndexDir);
MockDirectoryWrapper ramDir = new MockDirectoryWrapper(Random(), new RAMDirectory(dir, NewIOContext(Random())));
dir.Dispose();
IndexWriter writer = new IndexWriter(ramDir, (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetOpenMode(IndexWriterConfig.OpenMode_e.APPEND));
writer.ForceMerge(1);
Assert.AreEqual(ramDir.SizeInBytes(), ramDir.RecomputedSizeInBytes);
ThreadClass[] threads = new ThreadClass[NumThreads];
for (int i = 0; i < NumThreads; i++)
{
int num = i;
threads[i] = new ThreadAnonymousInnerClassHelper(this, writer, num);
}
for (int i = 0; i < NumThreads; i++)
{
threads[i].Start();
}
for (int i = 0; i < NumThreads; i++)
{
threads[i].Join();
}
writer.ForceMerge(1);
Assert.AreEqual(ramDir.SizeInBytes(), ramDir.RecomputedSizeInBytes);
writer.Dispose();
}