//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void metaFieldShouldPutPathListAtCorrectIndex() public virtual void MetaFieldShouldPutPathListAtCorrectIndex() { // given Graphdb().execute("CREATE (:Start)-[:R]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRow("MATCH p=(s)-[r:R]->(e) RETURN 10, p")); assertThat(commit, containsNoErrors()); assertThat(commit, rowContainsAMetaListAtIndex(1)); assertThat(commit.Status(), equalTo(200)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void returningAPartiallyDeletedPathRest() public virtual void ReturningAPartiallyDeletedPathRest() { // given Graphdb().execute("CREATE (:Start)-[:R]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRest("MATCH p=(s)-[r:R]->(e) DELETE s,r RETURN p")); assertThat(commit, containsNoErrors()); assertThat(commit.Status(), equalTo(200)); assertThat(NodesInDatabase(), equalTo(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailIfTryingToReturnPropsOfDeletedRelationshipRest() public virtual void ShouldFailIfTryingToReturnPropsOfDeletedRelationshipRest() { // given Graphdb().execute("CREATE (:Start)-[:MARKER {p: 'a property'}]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRest("MATCH (s)-[r:MARKER]->(e) DELETE r RETURN r.p")); assertThat("Error raw response: " + commit.RawContent(), commit, hasErrors(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.EntityNotFound)); assertThat(commit.Status(), equalTo(200)); assertThat(NodesInDatabase(), equalTo(2L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailIfTryingToReturnLabelsOfDeletedNodeRest() public virtual void ShouldFailIfTryingToReturnLabelsOfDeletedNodeRest() { // given Graphdb().execute("CREATE (:NodeToDelete)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRest("MATCH (n:NodeToDelete) DELETE n RETURN labels(n)")); assertThat(commit, hasErrors(Org.Neo4j.Kernel.Api.Exceptions.Status_Statement.EntityNotFound)); assertThat(commit.Status(), equalTo(200)); assertThat(NodesInDatabase(), equalTo(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotMarkNormalEntitiesAsDeletedRest() public virtual void ShouldNotMarkNormalEntitiesAsDeletedRest() { // given Graphdb().execute("CREATE (:Start)-[:R]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRest("MATCH (s:Start)-[r:R]->(e:End) RETURN *")); assertThat(commit, containsNoErrors()); assertThat(commit, restContainsNoDeletedEntities()); assertThat(commit.Status(), equalTo(200)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void metaFieldShouldGetCorrectIndex() public virtual void MetaFieldShouldGetCorrectIndex() { // given Graphdb().execute("CREATE (:Start)-[:R]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRow("MATCH (s:Start)-[r:R]->(e:End) RETURN s, r, 1, e")); assertThat(commit, containsNoErrors()); assertThat(commit, rowContainsMetaNodesAtIndex(0, 3)); assertThat(commit, rowContainsMetaRelsAtIndex(1)); assertThat(commit.Status(), equalTo(200)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void nestedShouldWorkRow() public virtual void NestedShouldWorkRow() { // given Graphdb().execute("CREATE ()"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRow("MATCH (n) DELETE (n) RETURN [n, {someKey: n}]")); assertThat(commit, containsNoErrors()); assertThat(commit.Status(), equalTo(200)); assertThat(commit, rowContainsDeletedEntities(2, 0)); assertThat(NodesInDatabase(), equalTo(0L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToReturnDeletedRelationshipsRest() public virtual void ShouldBeAbleToReturnDeletedRelationshipsRest() { // given Graphdb().execute("CREATE (:Start)-[:R {p: 'a property'}]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRest("MATCH (s)-[r:R]->(e) DELETE r RETURN r")); assertThat(commit, containsNoErrors()); assertThat(commit, restContainsDeletedEntities(1)); assertThat(commit.Status(), equalTo(200)); assertThat(NodesInDatabase(), equalTo(2L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToReturnDeletedNodesRest() public virtual void ShouldBeAbleToReturnDeletedNodesRest() { // given Graphdb().execute("CREATE (:NodeToDelete {p: 'a property'})"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRest("MATCH (n:NodeToDelete) DELETE n RETURN n")); assertThat(commit, containsNoErrors()); assertThat(commit, restContainsDeletedEntities(1)); assertThat(commit.Status(), equalTo(200)); assertThat(NodesInDatabase(), equalTo(0L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToReturnDeletedEntitiesRow() public virtual void ShouldBeAbleToReturnDeletedEntitiesRow() { // given Graphdb().execute("CREATE (:Start)-[:R]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonRow("MATCH (s:Start)-[r:R]->(e:End) DELETE s, r, e RETURN *")); assertThat(commit, containsNoErrors()); assertThat(commit, rowContainsDeletedEntities(2, 1)); assertThat(commit.Status(), equalTo(200)); assertThat(NodesInDatabase(), equalTo(0L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void returningADeletedPathGraph() public virtual void ReturningADeletedPathGraph() { // given Graphdb().execute("CREATE (:Start)-[:R]->(:End)"); // execute and commit HTTP.Response commit = _http.POST(_commitResource, QueryAsJsonGraph("MATCH p=(s)-[r:R]->(e) DELETE p RETURN p")); assertThat(commit, containsNoErrors()); assertThat(commit, graphContainsDeletedNodes(2)); assertThat(commit, graphContainsDeletedRelationships(1)); assertThat(commit.Status(), equalTo(200)); assertThat(NodesInDatabase(), equalTo(0L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() public virtual void SetUp() { // begin HTTP.Response begin = _http.POST("db/data/transaction"); assertThat(begin.Status(), equalTo(201)); AssertHasTxLocation(begin); try { _commitResource = begin.StringFromContent("commit"); } catch (JsonParseException e) { fail("Exception caught when setting up test: " + e.Message); } assertThat(_commitResource, equalTo(begin.Location() + "/commit")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleTemporalUsingGraphResultDataContent() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleTemporalUsingGraphResultDataContent() { //Given GraphDatabaseFacade db = Server().Database.Graph; ZonedDateTime date = ZonedDateTime.of(1980, 3, 11, 0, 0, 0, 0, ZoneId.of("Europe/Stockholm")); using (Transaction tx = Db.beginTx()) { Node node = Db.createNode(label("N")); node.SetProperty("date", date); tx.Success(); } //When HTTP.Response response = RunQuery("MATCH (n:N) RETURN n", "graph"); //Then assertEquals(200, response.Status()); AssertNoErrors(response); JsonNode row = response.Get("results").get(0).get("data").get(0).get("graph").get("nodes").get(0).get("properties").get("date"); assertEquals("\"1980-03-11T00:00+01:00[Europe/Stockholm]\"", row.ToString()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleDurationArraysUsingGraphResultDataContent() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleDurationArraysUsingGraphResultDataContent() { //Given GraphDatabaseFacade db = Server().Database.Graph; Duration duration = Duration.ofSeconds(73); using (Transaction tx = Db.beginTx()) { Node node = Db.createNode(label("N")); node.SetProperty("durations", new Duration[] { duration }); tx.Success(); } //When HTTP.Response response = RunQuery("MATCH (n:N) RETURN n", "graph"); //Then assertEquals(200, response.Status()); AssertNoErrors(response); JsonNode row = response.Get("results").get(0).get("data").get(0).get("graph").get("nodes").get(0).get("properties").get("durations").get(0); assertEquals("\"PT1M13S\"", row.ToString()); }