//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") private <T extends org.neo4j.bolt.messaging.ResponseMessage> T unpack(BoltResponseMessageReader reader, RecordingByteChannel channel)
        private T Unpack <T>(BoltResponseMessageReader reader, RecordingByteChannel channel) where T : Org.Neo4j.Bolt.messaging.ResponseMessage
        {
            // Unpack
            string serialized = HexPrinter.hex(channel.Bytes);
            BoltResponseMessageRecorder messages = new BoltResponseMessageRecorder();

            try
            {
                reader.Read(messages);
            }
            catch (Exception e)
            {
                throw new AssertionError("Failed to unpack message, wire data was:\n" + serialized + "[" + channel.Bytes.Length + "b]", e);
            }

            return(( T )messages.AsList()[0]);
        }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDiscardTheResult() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldDiscardTheResult()
        {
            BoltResponseMessageRecorder messageWriter = new BoltResponseMessageRecorder();
            ResultHandler handler = new ResultHandler(messageWriter, mock(typeof(BoltConnection)), NullLog.Instance);

            ImmutableRecord record1 = new ImmutableRecord(values("a", "b", "c"));
            ImmutableRecord record2 = new ImmutableRecord(values("1", "2", "3"));
            BoltResult      result  = new TestBoltResult(record1, record2);

            handler.OnRecords(result, false);
            handler.OnFinish();

            IList <ResponseMessage> messages = messageWriter.AsList();

            assertThat(messages.Count, equalTo(1));
            assertThat(messages[0], instanceOf(typeof(SuccessMessage)));
        }