//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void incrementalUserTransactionId() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void IncrementalUserTransactionId() { KernelTransactions kernelTransactions = NewKernelTransactions(); using (KernelTransaction kernelTransaction = kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AnonymousContext.none(), 0L)) { assertEquals(1, kernelTransactions.ActiveTransactions().GetEnumerator().next().UserTransactionId); } using (KernelTransaction kernelTransaction = kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AnonymousContext.none(), 0L)) { assertEquals(2, kernelTransactions.ActiveTransactions().GetEnumerator().next().UserTransactionId); } using (KernelTransaction kernelTransaction = kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, AnonymousContext.none(), 0L)) { assertEquals(3, kernelTransactions.ActiveTransactions().GetEnumerator().next().UserTransactionId); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotLeakTransactionOnSecurityContextFreezeFailure() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotLeakTransactionOnSecurityContextFreezeFailure() { KernelTransactions kernelTransactions = NewKernelTransactions(); LoginContext loginContext = mock(typeof(LoginContext)); when(loginContext.Authorize(any(), any())).thenThrow(new AuthorizationExpiredException("Freeze failed.")); assertException(() => kernelTransactions.NewInstance(KernelTransaction.Type.@explicit, loginContext, 0L), typeof(AuthorizationExpiredException), "Freeze failed."); assertThat("We should not have any transaction", kernelTransactions.ActiveTransactions(), @is(empty())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void transactionCloseRemovesTxFromActiveTransactions() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TransactionCloseRemovesTxFromActiveTransactions() { KernelTransactions kernelTransactions = NewTestKernelTransactions(); KernelTransaction tx1 = GetKernelTransaction(kernelTransactions); KernelTransaction tx2 = GetKernelTransaction(kernelTransactions); KernelTransaction tx3 = GetKernelTransaction(kernelTransactions); tx1.Close(); tx3.Close(); assertEquals(asSet(NewHandle(tx2)), kernelTransactions.ActiveTransactions()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListActiveTransactions() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldListActiveTransactions() { // Given KernelTransactions transactions = NewTestKernelTransactions(); // When KernelTransaction first = GetKernelTransaction(transactions); KernelTransaction second = GetKernelTransaction(transactions); KernelTransaction third = GetKernelTransaction(transactions); first.Close(); // Then assertThat(transactions.ActiveTransactions(), equalTo(asSet(NewHandle(second), NewHandle(third)))); }