//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void acquiringATransactionThatHasAlreadyBeenAcquiredShouldThrowInvalidConcurrentTransactionAccess() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AcquiringATransactionThatHasAlreadyBeenAcquiredShouldThrowInvalidConcurrentTransactionAccess() { // Given AssertableLogProvider logProvider = new AssertableLogProvider(); TransactionHandleRegistry registry = new TransactionHandleRegistry(Clocks.fakeClock(), 0, logProvider); TransactionHandle handle = mock(typeof(TransactionHandle)); long id = registry.Begin(handle); registry.Release(id, handle); registry.Acquire(id); // When try { registry.Acquire(id); fail("Should have thrown exception"); } catch (InvalidConcurrentTransactionAccess) { // expected } // then logProvider.AssertNoLoggingOccurred(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void noNotificationForTransactionLogs() public virtual void NoNotificationForTransactionLogs() { AssertableLogProvider internalLogProvider = new AssertableLogProvider(false); DefaultFileDeletionEventListener listener = BuildListener(internalLogProvider); listener.FileDeleted(TransactionLogFiles.DEFAULT_NAME + ".0"); listener.FileDeleted(TransactionLogFiles.DEFAULT_NAME + ".1"); internalLogProvider.AssertNoLoggingOccurred(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGenerateTransactionId() public virtual void ShouldGenerateTransactionId() { // given AssertableLogProvider logProvider = new AssertableLogProvider(); TransactionHandleRegistry registry = new TransactionHandleRegistry(Clocks.fakeClock(), 0, logProvider); TransactionHandle handle = mock(typeof(TransactionHandle)); // when long id1 = registry.Begin(handle); long id2 = registry.Begin(handle); // then assertNotEquals(id1, id2); logProvider.AssertNoLoggingOccurred(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldStoreSuspendedTransaction() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldStoreSuspendedTransaction() { // Given AssertableLogProvider logProvider = new AssertableLogProvider(); TransactionHandleRegistry registry = new TransactionHandleRegistry(Clocks.fakeClock(), 0, logProvider); TransactionHandle handle = mock(typeof(TransactionHandle)); long id = registry.Begin(handle); // When registry.Release(id, handle); TransactionHandle acquiredHandle = registry.Acquire(id); // Then assertSame(handle, acquiredHandle); logProvider.AssertNoLoggingOccurred(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogWhenLoggingThreadStarts() public virtual void ShouldLogWhenLoggingThreadStarts() { // given AssertableLogProvider logs = new AssertableLogProvider(); AsyncLogging logging = new AsyncLogging(logs.GetLog("meta")); // when (new AsyncLogProvider(logging.EventSender(), logs)).getLog("test").info("hello"); // then logs.AssertNoLoggingOccurred(); // when logging.Start(); logging.Stop(); // then logs.AssertExactly(inLog("test").info(endsWith("hello"))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void acquiringANonExistentTransactionShouldThrowErrorInvalidTransactionId() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void AcquiringANonExistentTransactionShouldThrowErrorInvalidTransactionId() { // Given AssertableLogProvider logProvider = new AssertableLogProvider(); TransactionHandleRegistry registry = new TransactionHandleRegistry(Clocks.fakeClock(), 0, logProvider); long madeUpTransactionId = 1337; // When try { registry.Acquire(madeUpTransactionId); fail("Should have thrown exception"); } catch (InvalidTransactionId) { // expected } // then logProvider.AssertNoLoggingOccurred(); }