Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void uniqueSamplingUseDocumentsNumber() throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void UniqueSamplingUseDocumentsNumber()
        {
            when(_indexSearcher.IndexReader.numDocs()).thenReturn(17);

            UniqueLuceneIndexSampler sampler = new UniqueLuceneIndexSampler(_indexSearcher, _taskControl.newInstance());
            IndexSample sample = sampler.SampleIndex();

            assertEquals(17, sample.IndexSize());
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void uniqueSamplingCancel()
        internal virtual void UniqueSamplingCancel()
        {
            when(_indexSearcher.IndexReader.numDocs()).thenAnswer(invocation =>
            {
                _taskControl.cancel();
                return(17);
            });

            UniqueLuceneIndexSampler     sampler = new UniqueLuceneIndexSampler(_indexSearcher, _taskControl.newInstance());
            IndexNotFoundKernelException notFoundKernelException = assertThrows(typeof(IndexNotFoundKernelException), sampler.sampleIndex);

            assertEquals(notFoundKernelException.Message, "Index dropped while sampling.");
        }