コード例 #1
0
ファイル: ReadyStateTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleAuthFailureDuringRunMessageProcessing() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldHandleAuthFailureDuringRunMessageProcessing()
        {
            AuthorizationExpiredException error = new AuthorizationExpiredException("Hello");

            when(_statementProcessor.run(any(), any())).thenThrow(error);

            BoltStateMachineState nextState = _state.process(new RunMessage("RETURN 1", EMPTY_MAP), _context);

            assertEquals(_failedState, nextState);
            verify(_context).handleFailure(error, true);
        }
コード例 #2
0
ファイル: StreamingStateTest.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandleAuthErrorWhenProcessingDiscardAllMessage() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldHandleAuthErrorWhenProcessingDiscardAllMessage()
        {
            AuthorizationExpiredException error = new AuthorizationExpiredException("Hello");

            StatementProcessor statementProcessor = mock(typeof(StatementProcessor));

            doThrow(error).when(statementProcessor).streamResult(any());
            _connectionState.StatementProcessor = statementProcessor;

            BoltStateMachineState nextState = _state.process(DiscardAllMessage.INSTANCE, _context);

            assertEquals(_failedState, nextState);
            verify(_context).handleFailure(error, true);
        }