Ejemplo n.º 1
0
        public SearchEngineApp(string resourcesDirectory) : base()
        {
            ResourcesDirectory = resourcesDirectory;
            var fileHandler = new FileHandler();

            Index  = new GoogleInvertedIndex(fileHandler.GetDocumentsFromFolder(ResourcesDirectory), fileHandler);
            prompt = AppName + "> ";
        }
Ejemplo n.º 2
0
 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
         );
 }
Ejemplo n.º 3
0
 public void Dispose()
 {
     sampleInvertedIndex = null;
 }