public void CloseAndReopen()
 {
     var indexer = ServiceLocator.Resolve<DocumentIndexer>();
     indexer.Dispose();
     var currentIndexer = new DocumentIndexer();
     ServiceLocator.RegisterInstance(currentIndexer);
     Assert.IsTrue(currentIndexer.GetNumberOfIndexedDocuments() > 5, "The index is being destroyed when it is closed and reopened");
 }
Exemplo n.º 2
0
        public void CloseAndReopen()
        {
            var indexer = ServiceLocator.Resolve <DocumentIndexer>();

            indexer.Dispose();
            var currentIndexer = new DocumentIndexer(TimeSpan.FromSeconds(10), GetTimeToCommit());

            ServiceLocator.RegisterInstance(currentIndexer);
            Assert.IsTrue(currentIndexer.GetNumberOfIndexedDocuments() > 5, "The index is being destroyed when it is closed and reopened");
        }
Exemplo n.º 3
0
 public void DocumentIndexer_DeleteDocuments()
 {
     try
     {
         TestUtils.ClearDirectory(PathManager.Instance.GetIndexPath(ServiceLocator.Resolve <SolutionKey>()));
         _documentIndexer = new DocumentIndexer(TimeSpan.FromSeconds(1));
         MethodElement sampleMethodElement = SampleProgramElementFactory.GetSampleMethodElement();
         _documentIndexer.AddDocument(DocumentFactory.Create(sampleMethodElement));
         int numDocs = _documentIndexer.GetNumberOfIndexedDocuments();
         Assert.IsTrue(numDocs == 1);
         _documentIndexer.DeleteDocuments(sampleMethodElement.FullFilePath);
         int docs = _documentIndexer.GetNumberOfIndexedDocuments();
         Assert.IsTrue(docs == 0);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message + ". " + ex.StackTrace);
     }
 }
Exemplo n.º 4
0
 public void DocumentIndexer_DeleteDocuments()
 {
     try
     {
         TestUtils.ClearDirectory(PathManager.Instance.GetIndexPath(ServiceLocator.Resolve<SolutionKey>()));
         _documentIndexer = new DocumentIndexer();
         MethodElement sampleMethodElement = SampleProgramElementFactory.GetSampleMethodElement();
         _documentIndexer.AddDocument(DocumentFactory.Create(sampleMethodElement));
         Thread.Sleep(2000);
         int numDocs = _documentIndexer.GetNumberOfIndexedDocuments();
         Assert.IsTrue(numDocs == 1);
         _documentIndexer.DeleteDocuments(sampleMethodElement.FullFilePath);
         Thread.Sleep(2000);
         int docs = _documentIndexer.GetNumberOfIndexedDocuments();
         Assert.IsTrue(docs == 0);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message + ". " + ex.StackTrace);
     }
 }