private IList <long> ExpectedIdsInOrder(NodeValueTuple from, bool fromInclusive, NodeValueTuple to, bool toInclusive, IndexOrder indexOrder)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IList <long> expectedIdsInOrder = _singlePropValues.subSet(from, fromInclusive, to, toInclusive).Select(NodeValueTuple::nodeId).ToList();

            if (indexOrder == IndexOrder.DESCENDING)
            {
                expectedIdsInOrder.Reverse();
            }
            return(expectedIdsInOrder);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldProvideResultInOrderIfCapable() throws org.neo4j.internal.kernel.api.exceptions.KernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldProvideResultInOrderIfCapable()
        {
            int label = Token.nodeLabel("Node");
            int prop  = Token.propertyKey("prop");

            RandomValues   randomValues = RandomRule.randomValues();
            IndexReference index        = SchemaRead.index(label, prop);

            for (int i = 0; i < _nIterations; i++)
            {
                ValueType    type  = randomValues.Among(_targetedTypes);
                IndexOrder[] order = index.OrderCapability(type.valueGroup.category());
                foreach (IndexOrder indexOrder in order)
                {
                    if (indexOrder == IndexOrder.NONE)
                    {
                        continue;
                    }
                    NodeValueTuple from = new NodeValueTuple(this, long.MinValue, randomValues.NextValueOfType(type));
                    NodeValueTuple to   = new NodeValueTuple(this, long.MaxValue, randomValues.NextValueOfType(type));
                    if (COMPARATOR.compare(from, to) > 0)
                    {
                        NodeValueTuple tmp = from;
                        from = to;
                        to   = tmp;
                    }
                    bool fromInclusive = randomValues.NextBoolean();
                    bool toInclusive   = randomValues.NextBoolean();
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.internal.kernel.api.IndexQuery.RangePredicate<?> range = org.neo4j.internal.kernel.api.IndexQuery.range(prop, from.getOnlyValue(), fromInclusive, to.getOnlyValue(), toInclusive);
                    IndexQuery.RangePredicate <object> range = IndexQuery.range(prop, from.OnlyValue, fromInclusive, to.OnlyValue, toInclusive);

                    using (NodeValueIndexCursor node = Cursors.allocateNodeValueIndexCursor())
                    {
                        Read.nodeIndexSeek(index, node, indexOrder, false, range);

                        IList <long> expectedIdsInOrder = expectedIdsInOrder(from, fromInclusive, to, toInclusive, indexOrder);
                        IList <long> actualIdsInOrder   = new List <long>();
                        while (node.Next())
                        {
                            actualIdsInOrder.Add(node.NodeReference());
                        }

                        assertEquals(expectedIdsInOrder, actualIdsInOrder, "actual node ids not in same order as expected");
                    }
                }
            }
        }
        public override void CreateTestGraph(GraphDatabaseService graphDb)
        {
            using (Transaction tx = graphDb.BeginTx())
            {
                graphDb.Schema().indexFor(label("Node")).on("prop").create();
                graphDb.Schema().indexFor(label("Node")).on("prop").on("prip").create();
                tx.Success();
            }
            using (Transaction tx = graphDb.BeginTx())
            {
                graphDb.Schema().awaitIndexesOnline(5, MINUTES);
                tx.Success();
            }

            RandomValues randomValues = RandomRule.randomValues();

            ValueType[] allExceptNonOrderable = RandomValues.excluding(ValueType.STRING, ValueType.STRING_ARRAY, ValueType.GEOGRAPHIC_POINT, ValueType.GEOGRAPHIC_POINT_ARRAY, ValueType.GEOGRAPHIC_POINT_3D, ValueType.GEOGRAPHIC_POINT_3D_ARRAY, ValueType.CARTESIAN_POINT, ValueType.CARTESIAN_POINT_ARRAY, ValueType.CARTESIAN_POINT_3D, ValueType.CARTESIAN_POINT_3D_ARRAY);
            _targetedTypes = randomValues.Selection(allExceptNonOrderable, 1, allExceptNonOrderable.Length, false);
            _targetedTypes = EnsureHighEnoughCardinality(_targetedTypes);
            using (Transaction tx = graphDb.BeginTx())
            {
                for (int i = 0; i < _nNodes; i++)
                {
                    Node           node = graphDb.CreateNode(label("Node"));
                    Value          propValue;
                    Value          pripValue;
                    NodeValueTuple singleValue;
                    NodeValueTuple doubleValue;
                    do
                    {
                        propValue   = randomValues.NextValueOfTypes(_targetedTypes);
                        pripValue   = randomValues.NextValueOfTypes(_targetedTypes);
                        singleValue = new NodeValueTuple(this, node.Id, propValue);
                        doubleValue = new NodeValueTuple(this, node.Id, propValue, pripValue);
                    } while (_singlePropValues.Contains(singleValue) || _doublePropValues.Contains(doubleValue));
                    _singlePropValues.Add(singleValue);
                    _doublePropValues.Add(doubleValue);

                    node.SetProperty("prop", propValue.AsObject());
                    node.SetProperty("prip", pripValue.AsObject());
                }
                tx.Success();
            }
        }