public SearchEngineApp(string resourcesDirectory) : base() { ResourcesDirectory = resourcesDirectory; var fileHandler = new FileHandler(); Index = new GoogleInvertedIndex(fileHandler.GetDocumentsFromFolder(ResourcesDirectory), fileHandler); prompt = AppName + "> "; }
public GoogleInvertedIndexTests() { mockedFileHandler = new Mock <FileHandler>(); mockedFileHandler.Setup(index => index.GetFileTokens("path/doc1.txt")) .Returns( new HashSet <Token> { new Token("first"), new Token("second"), new Token("third") } ); mockedFileHandler.Setup(index => index.GetFileTokens("path/doc2.txt")) .Returns( new HashSet <Token> { new Token("hello"), new Token("world"), } ); mockedFileHandler.Setup(index => index.GetFileTokens("path/doc3.txt")) .Returns( new HashSet <Token> { new Token("first"), new Token("third"), new Token("secon"), new Token("secoond"), new Token("firts") } ); sampleInvertedIndex = new GoogleInvertedIndex( new List <Document> { new Document("doc1.txt", "path/doc1.txt"), new Document("doc2.txt", "path/doc2.txt"), new Document("doc3.txt", "path/doc3.txt") }, mockedFileHandler.Object ); }
public void Dispose() { sampleInvertedIndex = null; }