//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReadDefragCountUsingStaticMethod() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldReadDefragCountUsingStaticMethod() { EphemeralFileSystemAbstraction fs = Fsr.get(); IdGeneratorImpl.CreateGenerator(fs, _file, 0, false); IdGeneratorImpl idGenerator = new IdGeneratorImpl(fs, _file, 1, 10000, false, IdType.Node, () => 0L); idGenerator.NextId(); long a = idGenerator.NextId(); idGenerator.NextId(); long b = idGenerator.NextId(); idGenerator.NextId(); idGenerator.FreeId(a); idGenerator.FreeId(b); long expectedDefragCount = idGenerator.DefragCount; idGenerator.Dispose(); long actualDefragCount = IdGeneratorImpl.ReadDefragCount(fs, _file); assertEquals(2, expectedDefragCount); assertEquals(expectedDefragCount, actualDefragCount); }
internal ReadOnlyIdGenerator(System.Func <long> highId, FileSystemAbstraction fs, File filename) { if (fs != null && fs.FileExists(filename)) { try { this.HighIdConflict = IdGeneratorImpl.ReadHighId(fs, filename); DefragCountConflict = IdGeneratorImpl.ReadDefragCount(fs, filename); } catch (IOException e) { throw new UnderlyingStorageException("Failed to read id counts of the id file: " + filename, e); } } else { this.HighIdConflict = highId(); DefragCountConflict = 0; } }