//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 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 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 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 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(); }
private static BoltResponseMessageWriterV1 NewWriter(PackOutput output, Org.Neo4j.Bolt.messaging.Neo4jPack_Packer packer) { return(new BoltResponseMessageWriterV1(@out => packer, output, NullLogService.Instance)); }