예제 #1
0
//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);
        }
예제 #2
0
//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");
        }