//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFilterResults()
        public virtual void ShouldFilterResults()
        {
            // given
            IList <string> keys = new List <string>();

            for (int i = 0; i < 100; i++)
            {
                // duplicates are fine
                keys.Add(Random.nextAlphaNumericString());
            }

            RawCursor <Hit <StringIndexKey, NativeIndexValue>, IOException> cursor = new ResultCursor(keys.GetEnumerator());

            IndexQuery[] predicates          = new IndexQuery[] { mock(typeof(IndexQuery)) };
            System.Predicate <string> filter = @string => @string.contains("a");
            when(predicates[0].AcceptsValue(any(typeof(Value)))).then(invocation => filter((( TextValue )invocation.getArgument(0)).stringValue()));
            FilteringNativeHitIterator <StringIndexKey, NativeIndexValue> iterator = new FilteringNativeHitIterator <StringIndexKey, NativeIndexValue>(cursor, new List <RawCursor <Hit <KEY, VALUE>, IOException> >(), predicates);
            IList <long> result = new List <long>();

            // when
            while (iterator.hasNext())
            {
                result.Add(iterator.next());
            }

            // then
            for (int i = 0; i < keys.Count; i++)
            {
                if (filter(keys[i]))
                {
                    assertTrue(result.RemoveAt(( long )i));
                }
            }
            assertTrue(result.Count == 0);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFilterResults()
        public virtual void ShouldFilterResults()
        {
            // given
            IList <string> keys = new List <string>();

            for (int i = 0; i < 100; i++)
            {
                // duplicates are fine
                keys.Add(Random.nextString());
            }

            RawCursor <Hit <StringIndexKey, NativeIndexValue>, IOException> cursor = new ResultCursor(keys.GetEnumerator());
            NodeValueIterator valueClient = new NodeValueIteratorAnonymousInnerClass(this);

            IndexQuery[] predicates          = new IndexQuery[] { mock(typeof(IndexQuery)) };
            System.Predicate <string> filter = @string => @string.contains("a");
            when(predicates[0].AcceptsValue(any(typeof(Value)))).then(invocation => filter((( TextValue )invocation.getArgument(0)).stringValue()));
            FilteringNativeHitIndexProgressor <StringIndexKey, NativeIndexValue> progressor = new FilteringNativeHitIndexProgressor <StringIndexKey, NativeIndexValue>(cursor, valueClient, new List <RawCursor <Hit <KEY, VALUE>, IOException> >(), predicates);

            valueClient.Initialize(TestIndexDescriptorFactory.forLabel(0, 0), progressor, predicates, IndexOrder.NONE, true);
            IList <long> result = new List <long>();

            // when
            while (valueClient.HasNext())
            {
                result.Add(valueClient.Next());
            }

            // then
            for (int i = 0; i < keys.Count; i++)
            {
                if (filter(keys[i]))
                {
                    assertTrue(result.RemoveAt(( long )i));
                }
            }
            assertTrue(result.Count == 0);
        }