public void TestAddDocumentToIndex() { DocumentIndex index = new DocumentIndex(IndexDir); index.Add(document1A); Assert.IsTrue(index.DocumentIdentity.Count == 1, "One document added"); }
public void TestIndexUnicity() { DocumentIdentity document1ABis = new DocumentIdentity(); document1ABis.Checksum = document1A.Checksum; document1ABis.FilePath = document1A.FilePath; document1ABis.DocumentID = document1A.DocumentID; document1ABis.State = IndexationStates.Undefined; DocumentIndex index = new DocumentIndex(IndexDir); index.Add(document1A); index.Add(document1ABis); Assert.IsTrue(index.DocumentIdentity.Count == 1, "One different document added"); document1ABis.State = IndexationStates.NotIndexed; index.Add(document1ABis); Assert.IsTrue(index.DocumentIdentity.Count == 1, "One different document added"); }
public void TestScan() { DocumentIndex index = new DocumentIndex(IndexDir); PluginManager plugin = new PluginManager(); plugin.Load(); index.PluginManager = plugin; index.Add(document1A); index.Scan(); foreach (var doc in index.DocumentIdentity) { Assert.IsTrue(doc.State == IndexationStates.Indexed, "All documents must be index after a scan"); } }
public void TestQuery() { DocumentIndex index = new DocumentIndex(IndexDir); PluginManager plugin = new PluginManager(); plugin.Load(); index.PluginManager = plugin; index.Add(document1A); index.Scan(); var result = index.Search( String.Format("Name:\"{0}\"", Path.GetFileNameWithoutExtension(document1A.FilePath))); Assert.IsTrue(result.Count() == 1, "Should found 1 doc, found = {0}", result.Count()); }