public void CheckFolderForExpectedResults(string searchString, string methodNameToFind, string solutionPath) { ServiceLocator.RegisterInstance<Analyzer>(new SnowballAnalyzer("English")); _indexer = new DocumentIndexer(); ServiceLocator.RegisterInstance(_indexer); try { IndexFilesInDirectory(solutionPath); Thread.Sleep(2000); var results = GetResults(searchString); Assert.IsTrue(HasResults(methodNameToFind, results), "Can't find expected results"); } catch (Exception ex) { Assert.Fail(ex.Message + ". " + ex.StackTrace); } finally { if (_indexer != null) _indexer.Dispose(true); } }
public void CheckFolderForExpectedResults(string searchString, string methodNameToFind, string solutionPath) { ServiceLocator.RegisterInstance <Analyzer>(new SnowballAnalyzer("English")); _indexer = new DocumentIndexer(TimeSpan.FromSeconds(1)); ServiceLocator.RegisterInstance(_indexer); try { IndexFilesInDirectory(solutionPath); var results = GetResults(searchString); Assert.IsTrue(HasResults(methodNameToFind, results), "Can't find expected results"); } catch (Exception ex) { Assert.Fail(ex.Message + ". " + ex.StackTrace); } finally { if (_indexer != null) { _indexer.Dispose(true); } } }
public void ShutdownIndexer() { _indexer.ClearIndex(); _indexer.Dispose(true); }