private void Exhaust(LabelScanValueIndexProgressor pro) { while (pro.Next()) { //do nothing } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseExhaustedCursors() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseExhaustedCursors() { // GIVEN RawCursor <Hit <LabelScanKey, LabelScanValue>, IOException> cursor = mock(typeof(RawCursor)); when(cursor.Next()).thenReturn(false); ICollection <RawCursor <Hit <LabelScanKey, LabelScanValue>, IOException> > toRemoveFrom = new HashSet <RawCursor <Hit <LabelScanKey, LabelScanValue>, IOException> >(); LabelScanValueIndexProgressor iterator = new LabelScanValueIndexProgressor(cursor, toRemoveFrom, mock(typeof(Org.Neo4j.Storageengine.Api.schema.IndexProgressor_NodeLabelClient))); verify(cursor, never()).close(); // WHEN Exhaust(iterator); verify(cursor, times(1)).close(); // retrying to get more items from the first one should not close it again iterator.Next(); verify(cursor, times(1)).close(); // and set should be empty assertTrue(toRemoveFrom.Count == 0); }