//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static org.neo4j.bolt.runtime.BoltResultHandle newResultHandle(Throwable t) throws org.neo4j.internal.kernel.api.exceptions.KernelException private static BoltResultHandle NewResultHandle(Exception t) { BoltResultHandle resultHandle = mock(typeof(BoltResultHandle)); when(resultHandle.Start()).thenThrow(t); return(resultHandle); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static org.neo4j.bolt.runtime.BoltResultHandle newResultHandle() throws org.neo4j.internal.kernel.api.exceptions.KernelException private static BoltResultHandle NewResultHandle() { BoltResultHandle resultHandle = mock(typeof(BoltResultHandle)); when(resultHandle.Start()).thenReturn(BoltResult.EMPTY); return(resultHandle); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static TransactionStateMachineV1SPI newTransactionStateMachineSPI(org.neo4j.kernel.api.KernelTransaction transaction) throws org.neo4j.internal.kernel.api.exceptions.KernelException private static TransactionStateMachineV1SPI NewTransactionStateMachineSPI(KernelTransaction transaction) { BoltResultHandle resultHandle = NewResultHandle(); TransactionStateMachineV1SPI stateMachineSPI = mock(typeof(TransactionStateMachineV1SPI)); when(stateMachineSPI.BeginTransaction(any(), any(), any())).thenReturn(transaction); when(stateMachineSPI.ExecuteQuery(any(), anyString(), any(), any(), any())).thenReturn(resultHandle); return(stateMachineSPI); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldCloseResultAndTransactionHandlesWhenExecutionFails() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ShouldCloseResultAndTransactionHandlesWhenExecutionFails() { KernelTransaction transaction = NewTransaction(); BoltResultHandle resultHandle = NewResultHandle(new Exception("some error")); TransactionStateMachineV1SPI stateMachineSPI = NewTransactionStateMachineSPI(transaction, resultHandle); TransactionStateMachine stateMachine = NewTransactionStateMachine(stateMachineSPI); Exception e = assertThrows(typeof(Exception), () => stateMachine.Run("SOME STATEMENT", null)); assertEquals("some error", e.Message); assertNull(stateMachine.Ctx.currentResultHandle); assertNull(stateMachine.Ctx.currentResult); assertNull(stateMachine.Ctx.currentTransaction); }