private TheStore NewStore() { LogProvider log = NullLogProvider.Instance; TheStore store = new TheStore(_storeFile, _idStoreFile, _config, _idType, _idGeneratorFactory, _pageCache, log, _recordFormat); store.Initialise(false); return(store); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseStoreFileFirstAndIdGeneratorAfter() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldCloseStoreFileFirstAndIdGeneratorAfter() { // given TheStore store = NewStore(); InOrder inOrder = inOrder(_pageFile, _idGenerator); // when store.Close(); // then inOrder.verify(_pageFile, times(1)).close(); inOrder.verify(_idGenerator, times(1)).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwsWhenRecordWithReservedIdIsUpdated() public virtual void ThrowsWhenRecordWithReservedIdIsUpdated() { TheStore store = NewStore(); TheRecord record = NewRecord(IdGeneratorImpl.INTEGER_MINUS_ONE); try { store.UpdateRecord(record); fail("Should have failed"); } catch (Exception e) { assertThat(e, instanceOf(typeof(ReservedIdException))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwsWhenRecordWithNegativeIdIsUpdated() public virtual void ThrowsWhenRecordWithNegativeIdIsUpdated() { TheStore store = NewStore(); TheRecord record = NewRecord(-1); try { store.UpdateRecord(record); fail("Should have failed"); } catch (Exception e) { assertThat(e, instanceOf(typeof(NegativeIdException))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void throwsWhenRecordWithTooHighIdIsUpdated() public virtual void ThrowsWhenRecordWithTooHighIdIsUpdated() { long maxFormatId = 42; when(_recordFormat.MaxId).thenReturn(maxFormatId); TheStore store = NewStore(); TheRecord record = NewRecord(maxFormatId + 1); try { store.UpdateRecord(record); fail("Should have failed"); } catch (Exception e) { assertThat(e, instanceOf(typeof(IdCapacityExceededException))); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldDeleteOnCloseIfOpenOptionsSaysSo() public virtual void ShouldDeleteOnCloseIfOpenOptionsSaysSo() { // GIVEN DatabaseLayout databaseLayout = _dir.databaseLayout(); File nodeStore = databaseLayout.NodeStore(); File idFile = databaseLayout.IdFile(DatabaseFile.NODE_STORE).orElseThrow(() => new System.InvalidOperationException("Node store id file not found.")); FileSystemAbstraction fs = _fileSystemRule.get(); PageCache pageCache = _pageCacheRule.getPageCache(fs, Config.defaults()); TheStore store = new TheStore(nodeStore, databaseLayout.IdNodeStore(), _config, _idType, new DefaultIdGeneratorFactory(fs), pageCache, NullLogProvider.Instance, _recordFormat, DELETE_ON_CLOSE); store.Initialise(true); store.MakeStoreOk(); assertTrue(fs.FileExists(nodeStore)); assertTrue(fs.FileExists(idFile)); // WHEN store.Close(); // THEN assertFalse(fs.FileExists(nodeStore)); assertFalse(fs.FileExists(idFile)); }