//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldThrowOnUnpackingMapWithDuplicateKeys() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldThrowOnUnpackingMapWithDuplicateKeys() { // Given PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); packer.PackMapHeader(2); packer.Pack("key"); packer.pack(intValue(1)); packer.Pack("key"); packer.pack(intValue(2)); // When try { PackedInputArray input = new PackedInputArray(output.Bytes()); Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker = _neo4jPack.newUnpacker(input); unpacker.Unpack(); fail("exception expected"); } catch (BoltIOException ex) { assertEquals(Neo4jError.from(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.Invalid, "Duplicate map key `key`."), Neo4jError.from(ex)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotNotifyOutputWhenOutputItselfFails() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotNotifyOutputWhenOutputItselfFails() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); IOException error = new IOException("Unable to flush"); doThrow(error).when(output).messageSucceeded(); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); try { writer.Write(new RecordMessage(() => new AnyValue[] { longValue(1), longValue(2) })); fail("Exception expected"); } catch (IOException e) { assertEquals(error, e); } InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(longValue(1)); inOrder.verify(packer).pack(longValue(2)); inOrder.verify(output).messageSucceeded(); verify(output, never()).messageFailed(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFailWhenTryingToPackAndUnpackMapContainingNullKeys() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFailWhenTryingToPackAndUnpackMapContainingNullKeys() { // Given PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); IDictionary <string, AnyValue> map = new Dictionary <string, AnyValue>(); map[null] = longValue(42L); map["foo"] = longValue(1337L); packer.PackMapHeader(map.Count); foreach (KeyValuePair <string, AnyValue> entry in map.SetOfKeyValuePairs()) { packer.pack(entry.Key); packer.pack(entry.Value); } // When try { PackedInputArray input = new PackedInputArray(output.Bytes()); Org.Neo4j.Bolt.messaging.Neo4jPack_Unpacker unpacker = _neo4jPack.newUnpacker(input); unpacker.Unpack(); fail("exception expected"); } catch (BoltIOException ex) { assertEquals(Neo4jError.from(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.Invalid, "Value `null` is not supported as key in maps, must be a non-nullable string."), Neo4jError.from(ex)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToPackAndUnpackMap() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToPackAndUnpackMap() { // Given PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); packer.PackMapHeader(ALICE.properties().size()); ALICE.properties().@foreach((s, value) => { try { packer.pack(s); packer.pack(value); } catch (IOException e) { throw new UncheckedIOException(e); } }); AnyValue unpacked = unpacked(output.Bytes()); // Then assertThat(unpacked, instanceOf(typeof(MapValue))); MapValue unpackedMap = ( MapValue )unpacked; assertThat(unpackedMap, equalTo(ALICE.properties())); }
//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 byte[] packed(org.neo4j.values.AnyValue object) throws java.io.IOException private sbyte[] Packed(AnyValue @object) { PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); packer.Pack(@object); return(output.Bytes()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void packMapWithNullKey(org.neo4j.bolt.messaging.Neo4jPack_Packer packer) throws java.io.IOException private static void PackMapWithNullKey(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer) { packer.PackMapHeader(2); packer.Pack("key1"); packer.Pack(ValueUtils.of(null)); packer.Pack(ValueUtils.of(null)); packer.Pack("value1"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static void packMapWithDuplicateKey(org.neo4j.bolt.messaging.Neo4jPack_Packer packer) throws java.io.IOException private static void PackMapWithDuplicateKey(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer) { packer.PackMapHeader(2); packer.Pack("key1"); packer.Pack("value1"); packer.Pack("key1"); packer.Pack("value2"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private byte[] packMessageWithSignature(byte signature) throws java.io.IOException private sbyte[] PackMessageWithSignature(sbyte signature) { PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = PackerUnderTest.newPacker(@out); packer.PackStructHeader(2, signature); packer.Pack("RETURN 'Hello World!'"); packer.pack(EMPTY_MAP); return(@out.Bytes()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private byte[] createMsg(byte signature) throws java.io.IOException private sbyte[] CreateMsg(sbyte signature) { PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = Neo4jPack.newPacker(@out); packer.PackStructHeader(0, signature); return(@out.Bytes()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private byte[] beginMessage(java.util.Map<String,Object> metadata) throws java.io.IOException private sbyte[] BeginMessage(IDictionary <string, object> metadata) { PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = Util.Neo4jPack.newPacker(@out); packer.PackStructHeader(1, BeginMessage.SIGNATURE); packer.pack(asMapValue(metadata)); return(@out.Bytes()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldFlush() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldFlush() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); writer.Flush(); verify(packer).flush(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private byte[] createMsgWithDuplicateKey(byte signature) throws java.io.IOException private sbyte[] CreateMsgWithDuplicateKey(sbyte signature) { PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = Neo4jPack.newPacker(@out); packer.PackStructHeader(2, signature); packer.Pack("Text"); PackMapWithDuplicateKey(packer); return(@out.Bytes()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldEncodeIgnoredMessage() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldEncodeIgnoredMessage() { // Given Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); IgnoredMessageEncoder encoder = new IgnoredMessageEncoder(); // When encoder.Encode(packer, IGNORED_MESSAGE); // Then verify(packer).packStructHeader(anyInt(), eq(IgnoredMessage.SIGNATURE)); }
//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)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTreatSingleCharAsSingleCharacterString() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTreatSingleCharAsSingleCharacterString() { // Given PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); packer.pack(charValue('C')); AnyValue unpacked = unpacked(output.Bytes()); // Then assertThat(unpacked, instanceOf(typeof(TextValue))); assertThat(unpacked, equalTo(stringValue("C"))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldTreatCharArrayAsListOfStrings() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldTreatCharArrayAsListOfStrings() { // Given PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); packer.pack(charArray(new char[] { 'W', 'H', 'Y' })); object unpacked = unpacked(output.Bytes()); // Then assertThat(unpacked, instanceOf(typeof(ListValue))); assertThat(unpacked, equalTo(VirtualValues.list(stringValue("W"), stringValue("H"), stringValue("Y")))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private byte[] createMsgWithUnknownValue(byte signature) throws java.io.IOException private sbyte[] CreateMsgWithUnknownValue(sbyte signature) { PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = Neo4jPack.newPacker(@out); packer.PackStructHeader(2, signature); packer.Pack("Text"); packer.PackMapHeader(1); packer.Pack("key1"); packer.PackStructHeader(0, ( sbyte )'A'); return(@out.Bytes()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private byte[] createRunWith(org.neo4j.function.ThrowingConsumer<org.neo4j.bolt.messaging.Neo4jPack_Packer, java.io.IOException> valuePacker) throws java.io.IOException private sbyte[] CreateRunWith(ThrowingConsumer <Org.Neo4j.Bolt.messaging.Neo4jPack_Packer, IOException> valuePacker) { PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = (new Neo4jPackV2()).newPacker(@out); packer.PackStructHeader(2, RunMessage.SIGNATURE); packer.Pack("RETURN $x"); packer.PackMapHeader(1); packer.Pack("x"); valuePacker.Accept(packer); return(@out.Bytes()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private byte[] createRunWithV1Value(org.neo4j.values.AnyValue value) throws java.io.IOException private sbyte[] CreateRunWithV1Value(AnyValue value) { PackedOutputArray @out = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = Neo4jPack.newPacker(@out); packer.PackStructHeader(2, RunMessage.SIGNATURE); packer.Pack("RETURN $x"); packer.PackMapHeader(1); packer.Pack("x"); packer.Pack(value); return(@out.Bytes()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static byte[] encode(org.neo4j.bolt.messaging.Neo4jPack neo4jPack, org.neo4j.bolt.messaging.RequestMessage... messages) throws java.io.IOException public static sbyte[] Encode(Neo4jPack neo4jPack, params RequestMessage[] messages) { RecordingByteChannel rawData = new RecordingByteChannel(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = neo4jPack.NewPacker(new BufferedChannelOutput(rawData)); BoltRequestMessageWriter writer = RequestMessageWriter(packer); foreach (RequestMessage message in messages) { writer.Write(message); } writer.Flush(); return(rawData.Bytes); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldEncodeRecordMessage() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldEncodeRecordMessage() { // Given Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); RecordMessageEncoder encoder = new RecordMessageEncoder(); // When Org.Neo4j.Cypher.result.QueryResult_Record value = mock(typeof(Org.Neo4j.Cypher.result.QueryResult_Record)); when(value.Fields()).thenReturn(new AnyValue[0]); encoder.Encode(packer, new RecordMessage(value)); // Then verify(packer).packStructHeader(anyInt(), eq(RecordMessage.SIGNATURE)); verify(packer).packListHeader(0); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldEncodeSuccessMessage() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldEncodeSuccessMessage() { // Given Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); SuccessMessageEncoder encoder = new SuccessMessageEncoder(); // When MapValue meta = mock(typeof(MapValue)); encoder.Encode(packer, new SuccessMessage(meta)); // Then verify(packer).packStructHeader(anyInt(), eq(SuccessMessage.SIGNATURE)); verify(packer).pack(meta); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteIgnoredMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteIgnoredMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); writer.Write(IgnoredMessage.IGNORED_MESSAGE); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).packStructHeader(0, IGNORED.signature()); inOrder.verify(output).messageSucceeded(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldLogErrorIfIsFatalError() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldLogErrorIfIsFatalError() { Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); Log log = mock(typeof(Log)); FailureMessageEncoder encoder = new FailureMessageEncoder(log); // When Org.Neo4j.Cypher.result.QueryResult_Record value = mock(typeof(Org.Neo4j.Cypher.result.QueryResult_Record)); when(value.Fields()).thenReturn(new AnyValue[0]); FatalFailureMessage message = new FatalFailureMessage(Org.Neo4j.Kernel.Api.Exceptions.Status_General.UnknownError, "I am an error message"); encoder.Encode(packer, message); // Then verify(log).debug("Encoding a fatal failure message to send. Message: %s", message); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteRecordMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteRecordMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); writer.Write(new RecordMessage(() => new AnyValue[] { longValue(42), stringValue("42") })); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(longValue(42)); inOrder.verify(packer).pack(stringValue("42")); inOrder.verify(output).messageSucceeded(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteSuccessMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteSuccessMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); MapValue metadata = map(new string[] { "a", "b", "c" }, new AnyValue[] { intValue(1), stringValue("2"), date(2010, 0x2, 0x2) }); writer.Write(new SuccessMessage(metadata)); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(metadata); inOrder.verify(output).messageSucceeded(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPackUtf8() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPackUtf8() { // Given string value = "\uD83D\uDE31"; sbyte[] bytes = value.GetBytes(Encoding.UTF8); TextValue textValue = utf8Value(bytes, 0, bytes.Length); PackedOutputArray output = new PackedOutputArray(); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = _neo4jPack.newPacker(output); packer.pack(textValue); // When AnyValue unpacked = unpacked(output.Bytes()); assertThat(unpacked, @is(instanceOf(typeof(UTF8StringValue)))); // Then assertThat(unpacked, equalTo(textValue)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldEncodeFailureMessage() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldEncodeFailureMessage() { // Given Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); Log log = mock(typeof(Log)); FailureMessageEncoder encoder = new FailureMessageEncoder(log); // When Org.Neo4j.Cypher.result.QueryResult_Record value = mock(typeof(Org.Neo4j.Cypher.result.QueryResult_Record)); when(value.Fields()).thenReturn(new AnyValue[0]); encoder.Encode(packer, new FailureMessage(Org.Neo4j.Kernel.Api.Exceptions.Status_General.UnknownError, "I am an error message")); // Then verify(log, never()).debug(anyString(), any(typeof(FailureMessage))); verify(packer).packStructHeader(anyInt(), eq(FailureMessage.SIGNATURE)); verify(packer).packMapHeader(2); verify(packer).pack("code"); verify(packer).pack("message"); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWriteFailureMessage() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWriteFailureMessage() { PackOutput output = mock(typeof(PackOutput)); Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer = mock(typeof(Org.Neo4j.Bolt.messaging.Neo4jPack_Packer)); BoltResponseMessageWriterV1 writer = NewWriter(output, packer); Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction errorStatus = Org.Neo4j.Kernel.Api.Exceptions.Status_Transaction.DeadlockDetected; string errorMessage = "Hi Deadlock!"; writer.Write(new FailureMessage(errorStatus, errorMessage)); InOrder inOrder = inOrder(output, packer); inOrder.verify(output).beginMessage(); inOrder.verify(packer).pack(errorStatus.code().serialize()); inOrder.verify(packer).pack(errorMessage); inOrder.verify(output).messageSucceeded(); }