//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void doesNotWaitWhenTxIdUpToDate() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void DoesNotWaitWhenTxIdUpToDate() { long lastClosedTransactionId = 100; System.Func <TransactionIdStore> txIdStore = () => FixedTxIdStore(lastClosedTransactionId); TransactionStateMachineV1SPI txSpi = CreateTxSpi(txIdStore, Duration.ZERO, Clock.systemUTC()); Future <Void> result = OtherThread.execute(state => { txSpi.AwaitUpToDate(lastClosedTransactionId - 42); return(null); }); assertNull(result.get(20, SECONDS)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwsWhenTxAwaitDurationExpires() public virtual void ThrowsWhenTxAwaitDurationExpires() { long lastClosedTransactionId = 100; System.Func <TransactionIdStore> txIdStore = () => FixedTxIdStore(lastClosedTransactionId); Duration txAwaitDuration = Duration.ofSeconds(42); FakeClock clock = new FakeClock(); DatabaseAvailabilityGuard databaseAvailabilityGuard = spy(new DatabaseAvailabilityGuard(DEFAULT_DATABASE_NAME, clock, NullLog.Instance)); when(databaseAvailabilityGuard.Available).then(invocation => { // move clock forward on the first availability check // this check is executed on every tx id polling iteration bool available = ( bool )invocation.callRealMethod(); clock.Forward(txAwaitDuration.Seconds + 1, SECONDS); return(available); }); TransactionStateMachineV1SPI txSpi = CreateTxSpi(txIdStore, txAwaitDuration, databaseAvailabilityGuard, clock); Future <Void> result = OtherThread.execute(state => { txSpi.AwaitUpToDate(lastClosedTransactionId + 42); return(null); }); try { result.get(20, SECONDS); } catch (Exception e) { assertThat(e, instanceOf(typeof(ExecutionException))); assertThat(e.InnerException, instanceOf(typeof(TransactionFailureException))); } }