//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldMapDirectRelationship() public virtual void ShouldMapDirectRelationship() { // Given Node start, end; Relationship relationship; using (Transaction tx = Db.beginTx()) { start = Db.createNode(); end = Db.createNode(); relationship = start.CreateRelationshipTo(end, RelationshipType.withName("R")); tx.Success(); } RelationshipValue relationshipValue = VirtualValues.relationshipValue(relationship.Id, nodeValue(start.Id, Values.EMPTY_TEXT_ARRAY, EMPTY_MAP), nodeValue(start.Id, Values.EMPTY_TEXT_ARRAY, EMPTY_MAP), stringValue("R"), EMPTY_MAP); // When Relationship coreAPIRelationship = _mapper.mapRelationship(relationshipValue); // Then using (Transaction ignore = Db.beginTx()) { assertThat(coreAPIRelationship.Id, equalTo(relationship.Id)); assertThat(coreAPIRelationship.StartNode, equalTo(start)); assertThat(coreAPIRelationship.EndNode, equalTo(end)); } }
public override RelationshipValue[] Relationships() { int length = _path.length(); RelationshipValue[] values = new RelationshipValue[length]; int i = 0; foreach (Relationship relationship in _path.relationships()) { values[i++] = ValueUtils.FromRelationshipProxy(relationship); } return(values); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleEdgeValueWithoutProperties() internal virtual void ShouldHandleEdgeValueWithoutProperties() { NodeValue startNode = VirtualValues.nodeValue(1L, Values.stringArray("L"), EMPTY_MAP); NodeValue endNode = VirtualValues.nodeValue(2L, Values.stringArray("L"), EMPTY_MAP); RelationshipValue rel = VirtualValues.relationshipValue(42L, startNode, endNode, stringValue("R"), EMPTY_MAP); PrettyPrinter printer = new PrettyPrinter(); // When rel.WriteTo(printer); // Then assertThat(printer.Value(), equalTo("-[id=42 :R]-")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleEdgeValue() internal virtual void ShouldHandleEdgeValue() { // Given NodeValue startNode = VirtualValues.nodeValue(1L, Values.stringArray("L"), EMPTY_MAP); NodeValue endNode = VirtualValues.nodeValue(2L, Values.stringArray("L"), EMPTY_MAP); RelationshipValue rel = VirtualValues.relationshipValue(42L, startNode, endNode, stringValue("R"), Props("foo", intValue(42), "bar", list(intValue(1337), stringValue("baz")))); PrettyPrinter printer = new PrettyPrinter(); // When rel.WriteTo(printer); // Then assertThat(printer.Value(), equalTo("-[id=42 :R {bar: [1337, \"baz\"], foo: 42}]-")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandlePaths() internal virtual void ShouldHandlePaths() { // Given NodeValue startNode = VirtualValues.nodeValue(1L, Values.stringArray("L"), EMPTY_MAP); NodeValue endNode = VirtualValues.nodeValue(2L, Values.stringArray("L"), EMPTY_MAP); RelationshipValue rel = VirtualValues.relationshipValue(42L, startNode, endNode, stringValue("R"), EMPTY_MAP); PathValue path = VirtualValues.path(new NodeValue[] { startNode, endNode }, new RelationshipValue[] { rel }); PrettyPrinter printer = new PrettyPrinter(); // When path.WriteTo(printer); // Then assertThat(printer.Value(), equalTo("(id=1 :L)-[id=42 :R]->(id=2 :L)")); }