//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void assertNodeAndValue(java.util.Set<org.neo4j.helpers.collection.Pair<long,org.neo4j.values.storable.Value>> expected, Transaction tx, boolean needsValues, Object anotherValueFoundByQuery, NodeValueIndexCursor nodes) throws Exception
        private void AssertNodeAndValue(ISet <Pair <long, Value> > expected, Transaction tx, bool needsValues, object anotherValueFoundByQuery, NodeValueIndexCursor nodes)
        {
            // Modify tx state with changes that should not be reflected in the cursor, since it was already initialized in the above statement
            foreach (Pair <long, Value> pair in expected)
            {
                tx.DataWrite().nodeDelete(pair.First());
            }
            NodeWithPropId(tx, anotherValueFoundByQuery);

            if (needsValues)
            {
                ISet <Pair <long, Value> > found = new HashSet <Pair <long, Value> >();
                while (nodes.Next())
                {
                    found.Add(Pair.of(nodes.NodeReference(), nodes.PropertyValue(0)));
                }

                assertThat(found, equalTo(expected));
            }
            else
            {
                ISet <long> foundIds = new HashSet <long>();
                while (nodes.Next())
                {
                    foundIds.Add(nodes.NodeReference());
                }
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
                ImmutableSet <long> expectedIds = expected.Select(Pair::first).collect(Collectors2.toImmutableSet());

                assertThat(foundIds, equalTo(expectedIds));
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldGetAllDoublePropertyValues() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldGetAllDoublePropertyValues()
        {
            int            label = Token.nodeLabel("Node");
            int            prop  = Token.propertyKey("prop");
            int            prip  = Token.propertyKey("prip");
            IndexReference index = SchemaRead.index(label, prop, prip);

            using (NodeValueIndexCursor node = Cursors.allocateNodeValueIndexCursor())
            {
                Read.nodeIndexScan(index, node, IndexOrder.NONE, true);

                IList <ValueTuple> values = new List <ValueTuple>();
                while (node.Next())
                {
                    values.Add(ValueTuple.of(node.PropertyValue(0), node.PropertyValue(1)));
                }

                values.sort(ValueTuple.COMPARATOR);
                for (int i = 0; i < _doublePropValues.Count; i++)
                {
                    assertEquals(_doublePropValues[i], values[i]);
                }
            }
        }
示例#3
0
        private void AssertResultsInOrder(IList <Pair <long, Value> > expected, NodeValueIndexCursor cursor)
        {
            IComparer <Pair <long, Value> > comparator = IndexOrder == IndexOrder.Ascending ? (a, b) => Values.COMPARATOR.Compare(a.other(), b.other()) : (a, b) => Values.COMPARATOR.Compare(b.other(), a.other());

            expected.sort(comparator);
            IEnumerator <Pair <long, Value> > expectedRows = expected.GetEnumerator();

            while (cursor.Next() && expectedRows.MoveNext())
            {
                Pair <long, Value> expectedRow = expectedRows.Current;
                assertThat(cursor.NodeReference(), equalTo(expectedRow.First()));
                for (int i = 0; i < cursor.NumberOfProperties(); i++)
                {
                    Value value = cursor.PropertyValue(i);
                    assertThat(value, equalTo(expectedRow.Other()));
                }
            }

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(expectedRows.hasNext());
            assertFalse(cursor.Next());
        }