//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canFormatListOfStrings() public virtual void CanFormatListOfStrings() { string entity = _json.assemble(ListRepresentation.strings("hello", "world")); string expectedString = JsonHelper.createJsonFrom(Arrays.asList("hello", "world")); assertEquals(expectedString, entity); }
public virtual void ShouldGet200ForProperties() { string entity = JsonHelper.createJsonFrom(Collections.singletonMap("foo", "bar")); JaxRsResponse createResponse = _req.post(_functionalTestHelper.dataUri() + "node/", entity); GenConflict.get().expectedStatus(200).get(createResponse.Location.ToString() + "/properties"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeJSONContentTypeOnPropertiesResponse() public virtual void ShouldBeJSONContentTypeOnPropertiesResponse() { string entity = JsonHelper.createJsonFrom(Collections.singletonMap("foo", "bar")); JaxRsResponse createResource = _req.post(_functionalTestHelper.dataUri() + "node/", entity); JaxRsResponse response = _req.get(createResource.Location.ToString() + "/properties"); assertThat(response.Type.ToString(), containsString(MediaType.APPLICATION_JSON)); }
protected internal static ThrowingConsumer <HttpServletResponse, IOException> Error(int code, object body) { return(response => { response.Status = code; response.addHeader(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8"); response.OutputStream.write(JsonHelper.createJsonFrom(body).getBytes(StandardCharsets.UTF_8)); }); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGetContentLengthHeaderForRetrievingProperties() public virtual void ShouldGetContentLengthHeaderForRetrievingProperties() { string entity = JsonHelper.createJsonFrom(Collections.singletonMap("foo", "bar")); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RestRequest request = req; RestRequest request = _req; JaxRsResponse createResponse = request.Post(_functionalTestHelper.dataUri() + "node/", entity); JaxRsResponse response = request.Get(createResponse.Location.ToString() + "/properties"); assertNotNull(response.Headers.get("Content-Length")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGetCorrectContentEncodingRetrievingProperties() throws org.neo4j.server.rest.domain.JsonParseException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGetCorrectContentEncodingRetrievingProperties() { string asianText = "\u4f8b\u5b50"; string germanText = "öäüÖÄÜß"; string complicatedString = asianText + germanText; string entity = JsonHelper.createJsonFrom(Collections.singletonMap("foo", complicatedString)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RestRequest request = req; RestRequest request = _req; JaxRsResponse createResponse = request.Post(_functionalTestHelper.dataUri() + "node/", entity); string response = ( string )JsonHelper.readJson(request.Get(GetPropertyUri(createResponse.Location.ToString(), "foo")).Entity); assertEquals(complicatedString, response); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGetCorrectContentEncodingRetrievingPropertiesWithStreaming() throws org.neo4j.server.rest.domain.JsonParseException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldGetCorrectContentEncodingRetrievingPropertiesWithStreaming() { string asianText = "\u4f8b\u5b50"; string germanText = "öäüÖÄÜß"; string complicatedString = asianText + germanText; string entity = JsonHelper.createJsonFrom(Collections.singletonMap("foo", complicatedString)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final RestRequest request = req.header(org.neo4j.server.rest.repr.formats.StreamingJsonFormat.STREAM_HEADER, "true"); RestRequest request = _req.header(StreamingJsonFormat.STREAM_HEADER, "true"); JaxRsResponse createResponse = request.Post(_functionalTestHelper.dataUri() + "node/", entity); string response = ( string )JsonHelper.readJson(request.Get(GetPropertyUri(createResponse.Location.ToString(), "foo"), new MediaType("application", "json", stringMap("stream", "true"))).Entity); assertEquals(complicatedString, response); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canFormatObjectWithStringField() public virtual void CanFormatObjectWithStringField() { string entity = _json.assemble(new MappingRepresentationAnonymousInnerClass(this)); assertEquals(JsonHelper.createJsonFrom(Collections.singletonMap("key", "expected string")), entity); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canFormatObjectWithNestedObject() public virtual void CanFormatObjectWithNestedObject() { _json.assemble(new MappingRepresentationAnonymousInnerClass4(this)); assertEquals(JsonHelper.createJsonFrom(Collections.singletonMap("nested", Collections.singletonMap("data", "expected data"))), _stream.ToString()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canFormatObjectWithUriField() public virtual void CanFormatObjectWithUriField() { _json.assemble(new MappingRepresentationAnonymousInnerClass3(this)); assertEquals(JsonHelper.createJsonFrom(Collections.singletonMap("URL", "http://localhost/subpath")), _stream.ToString()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void canFormatEmptyObject() public virtual void CanFormatEmptyObject() { _json.assemble(new MappingRepresentationAnonymousInnerClass(this)); assertEquals(JsonHelper.createJsonFrom(Collections.emptyMap()), _stream.ToString()); }