//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFormatMapsProperly() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFormatMapsProperly() { GraphDatabaseService graphdb = Database.GraphDatabaseAPI; Result result = graphdb.Execute("RETURN {one:{two:['wait for it...', {three: 'GO!'}]}}"); CypherResultRepresentation representation = new CypherResultRepresentation(result, false, false); // When IDictionary <string, object> serialized = SerializeToStringThenParseAsToMap(representation); // Then System.Collections.IDictionary one = (System.Collections.IDictionary)((System.Collections.IDictionary)((System.Collections.IList)((System.Collections.IList)serialized["data"])[0])[0])["one"]; System.Collections.IList two = (System.Collections.IList)one["two"]; assertThat(two[0], @is("wait for it...")); System.Collections.IDictionary foo = (System.Collections.IDictionary)two[1]; assertThat(foo["three"], @is("GO!")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldRenderNestedEntities() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRenderNestedEntities() { using (Transaction ignored = Database.GraphDatabaseAPI.beginTx()) { GraphDatabaseService graphdb = Database.GraphDatabaseAPI; graphdb.Execute("CREATE (n {name: 'Sally'}), (m {age: 42}), (n)-[r:FOO {drunk: false}]->(m)"); Result result = graphdb.Execute("MATCH p=(n)-[r]->(m) RETURN n, r, p, {node: n, edge: r, path: p}"); CypherResultRepresentation representation = new CypherResultRepresentation(result, false, false); // When IDictionary <string, object> serialized = SerializeToStringThenParseAsToMap(representation); // Then object firstRow = ((System.Collections.IList)serialized["data"])[0]; System.Collections.IDictionary nested = (System.Collections.IDictionary)((System.Collections.IList)firstRow)[3]; assertThat(nested["node"], @is(equalTo(((System.Collections.IList)firstRow)[0]))); assertThat(nested["edge"], @is(equalTo(((System.Collections.IList)firstRow)[1]))); assertThat(nested["path"], @is(equalTo(((System.Collections.IList)firstRow)[2]))); } }
public IterableWrapperAnonymousInnerClass(CypherResultRepresentation outerInstance, IEnumerable <IDictionary <string, object> > inner, IList <string> columns) : base(inner) { this.outerInstance = outerInstance; this._columns = columns; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private java.util.Map<String, Object> serializeToStringThenParseAsToMap(CypherResultRepresentation repr) throws Exception private IDictionary <string, object> SerializeToStringThenParseAsToMap(CypherResultRepresentation repr) { OutputFormat format = new OutputFormat(new JsonFormat(), new URI("http://localhost/"), null); return(jsonToMap(format.Assemble(repr))); }