Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCommitTransactions() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCommitTransactions()
        {
            // given
            TransactionToApply newTx1 = mock(typeof(TransactionToApply));
            TransactionToApply newTx2 = mock(typeof(TransactionToApply));
            TransactionToApply newTx3 = mock(typeof(TransactionToApply));

            StubLocalDatabase localDatabase = new StubLocalDatabase(1);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ReplayableCommitProcess txListener = new ReplayableCommitProcess(localDatabase, localDatabase);
            ReplayableCommitProcess txListener = new ReplayableCommitProcess(localDatabase, localDatabase);

            // when
            txListener.Commit(newTx1, NULL, EXTERNAL);
            txListener.Commit(newTx2, NULL, EXTERNAL);
            txListener.Commit(newTx3, NULL, EXTERNAL);

            // then
            verify(localDatabase.CommitProcess, times(3)).commit(any(typeof(TransactionToApply)), any(typeof(CommitEvent)), any(typeof(TransactionApplicationMode)));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotCommitTransactionsThatAreAlreadyCommittedLocally() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotCommitTransactionsThatAreAlreadyCommittedLocally()
        {
            // given
            TransactionToApply alreadyCommittedTx1 = mock(typeof(TransactionToApply));
            TransactionToApply alreadyCommittedTx2 = mock(typeof(TransactionToApply));
            TransactionToApply newTx = mock(typeof(TransactionToApply));

            StubLocalDatabase localDatabase = new StubLocalDatabase(3);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ReplayableCommitProcess txListener = new ReplayableCommitProcess(localDatabase, localDatabase);
            ReplayableCommitProcess txListener = new ReplayableCommitProcess(localDatabase, localDatabase);

            // when
            txListener.Commit(alreadyCommittedTx1, NULL, EXTERNAL);
            txListener.Commit(alreadyCommittedTx2, NULL, EXTERNAL);
            txListener.Commit(newTx, NULL, EXTERNAL);

            // then
            verify(localDatabase.CommitProcess, times(1)).commit(eq(newTx), any(typeof(CommitEvent)), any(typeof(TransactionApplicationMode)));
            verifyNoMoreInteractions(localDatabase.CommitProcess);
        }