コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadHighIdUsingStaticMethod() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadHighIdUsingStaticMethod()
        {
            // GIVEN
            long highId = 12345L;

            IdGeneratorImpl.CreateGenerator(Fsr.get(), _file, highId, false);

            // WHEN
            long readHighId = IdGeneratorImpl.ReadHighId(Fsr.get(), _file);

            // THEN
            assertEquals(highId, readHighId);
        }
コード例 #2
0
 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;
     }
 }