//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCallExternalErrorOnInitWithDuplicateKeys() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCallExternalErrorOnInitWithDuplicateKeys() { BoltStateMachine stateMachine = mock(typeof(BoltStateMachine)); SynchronousBoltConnection connection = new SynchronousBoltConnection(stateMachine); _channel = new EmbeddedChannel(NewDecoder(connection)); // Generate INIT message with duplicate keys PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = PackerUnderTest.newPacker(@out); packer.PackStructHeader(2, InitMessage.SIGNATURE); packer.Pack("Test/User Agent 1.0"); packer.PackMapHeader(3); packer.Pack("scheme"); packer.Pack("basic"); packer.Pack("principal"); packer.Pack("user"); packer.Pack("scheme"); packer.Pack("password"); _channel.writeInbound(Unpooled.wrappedBuffer(@out.Bytes())); _channel.finishAndReleaseAll(); verify(stateMachine).handleExternalFailure(eq(Neo4jError.from(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.Invalid, "Duplicate map key `scheme`.")), any()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private <T extends org.neo4j.bolt.messaging.RequestMessage> T serializeAndDeserialize(T msg) throws Exception private T SerializeAndDeserialize <T>(T msg) where T : Org.Neo4j.Bolt.messaging.RequestMessage { RecordingByteChannel channel = new RecordingByteChannel(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(new BufferedChannelOutput(channel)); BoltRequestMessageWriter writer = new BoltRequestMessageWriter(packer); writer.Write(msg).flush(); channel.Eof(); return(Unpack(channel)); }