//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFollowSpecificRelationship() public virtual void ShouldFollowSpecificRelationship() { // given using (NodeCursor node = cursors.allocateNodeCursor(), RelationshipGroupCursor group = cursors.allocateRelationshipGroupCursor(), RelationshipTraversalCursor relationship = cursors.allocateRelationshipTraversalCursor()) { // when - traversing from start to end read.singleNode(_start, node); assertTrue("access start node", node.Next()); node.Relationships(group); assertTrue("access relationship group", group.next()); group.Outgoing(relationship); assertTrue("access outgoing relationships", relationship.next()); // then assertEquals("source node", _start, relationship.SourceNodeReference()); assertEquals("target node", _end, relationship.TargetNodeReference()); assertEquals("node of origin", _start, relationship.OriginNodeReference()); assertEquals("neighbouring node", _end, relationship.NeighbourNodeReference()); assertEquals("relationship should have same label as group", group.Type(), relationship.Type()); assertFalse("only a single relationship", relationship.next()); group.Incoming(relationship); assertFalse("no incoming relationships", relationship.next()); group.Loops(relationship); assertFalse("no loop relationships", relationship.next()); assertFalse("only a single group", group.next()); // when - traversing from end to start read.singleNode(_end, node); assertTrue("access start node", node.Next()); node.Relationships(group); assertTrue("access relationship group", group.next()); group.Incoming(relationship); assertTrue("access incoming relationships", relationship.next()); // then assertEquals("source node", _start, relationship.SourceNodeReference()); assertEquals("target node", _end, relationship.TargetNodeReference()); assertEquals("node of origin", _end, relationship.OriginNodeReference()); assertEquals("neighbouring node", _start, relationship.NeighbourNodeReference()); assertEquals("relationship should have same label as group", group.Type(), relationship.Type()); assertFalse("only a single relationship", relationship.next()); group.Outgoing(relationship); assertFalse("no outgoing relationships", relationship.next()); group.Loops(relationship); assertFalse("no loop relationships", relationship.next()); assertFalse("only a single group", group.next()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldManageRandomTraversals() public virtual void ShouldManageRandomTraversals() { // given try { using (NodeCursor node = cursors.allocateNodeCursor(), RelationshipGroupCursor group = cursors.allocateRelationshipGroupCursor(), RelationshipTraversalCursor relationship = cursors.allocateRelationshipTraversalCursor()) { for (int i = 0; i < N_TRAVERSALS; i++) { // when long nodeId = _nodeIds[_random.Next(_nNodes)]; read.singleNode(nodeId, node); assertTrue("access root node", node.Next()); node.Relationships(group); assertFalse("single root", node.Next()); // then while (group.next()) { group.Incoming(relationship); while (relationship.next()) { assertEquals("incoming origin", nodeId, relationship.OriginNodeReference()); relationship.Neighbour(node); } group.Outgoing(relationship); while (relationship.next()) { assertEquals("outgoing origin", nodeId, relationship.OriginNodeReference()); relationship.Neighbour(node); } group.Loops(relationship); while (relationship.next()) { assertEquals("loop origin", nodeId, relationship.OriginNodeReference()); relationship.Neighbour(node); } } } } } catch (Exception t) { throw new Exception("Failed with random seed " + _seed, t); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static String computeKey(org.neo4j.internal.kernel.api.Transaction transaction, RelationshipTraversalCursor r) throws org.neo4j.internal.kernel.api.exceptions.KernelException private static string ComputeKey([email protected] transaction, RelationshipTraversalCursor r) { Direction d; if (r.SourceNodeReference() == r.TargetNodeReference()) { d = Direction.BOTH; } else if (r.SourceNodeReference() == r.OriginNodeReference()) { d = Direction.OUTGOING; } else { d = Direction.INCOMING; } return(ComputeKey(transaction.Token().relationshipTypeName(r.Type()), d)); }