public virtual void TestRAMDirectoryMem()
{
Directory dir = NewFSDirectory(IndexDir);
MockDirectoryWrapper ramDir = new MockDirectoryWrapper(Random(), new RAMDirectory(dir, NewIOContext(Random())));
// close the underlaying directory
dir.Dispose();
// Check size
Assert.AreEqual(ramDir.SizeInBytes(), ramDir.RecomputedSizeInBytes);
// open reader to test document count
IndexReader reader = DirectoryReader.Open(ramDir);
Assert.AreEqual(DocsToAdd, reader.NumDocs);
// open search zo check if all doc's are there
IndexSearcher searcher = NewSearcher(reader);
// search for all documents
for (int i = 0; i < DocsToAdd; i++)
{
Document doc = searcher.Doc(i);
Assert.IsTrue(doc.GetField("content") != null);
}
// cleanup
reader.Dispose();
}