Lucene.Net.Store.TestRAMDirectory.TestRAMDirectoryMem C# (CSharp) 메소드

TestRAMDirectoryMem() 개인적인 메소드

private TestRAMDirectoryMem ( ) : void
리턴 void
        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();
        }