Ejemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: static void changeVersionNumber(org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File storeFile, String versionString) throws java.io.IOException
        internal static void ChangeVersionNumber(FileSystemAbstraction fileSystem, File storeFile, string versionString)
        {
            sbyte[] versionBytes = UTF8.encode(versionString);
            using (StoreChannel fileChannel = fileSystem.Open(storeFile, OpenMode.READ_WRITE))
            {
                fileChannel.Position(fileSystem.GetFileSize(storeFile) - versionBytes.Length);
                fileChannel.write(ByteBuffer.wrap(versionBytes));
            }
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = IllegalArgumentException.class) public void shouldThrowWhenTryingToCreateFileThatAlreadyExists()
        public virtual void ShouldThrowWhenTryingToCreateFileThatAlreadyExists()
        {
            // Given
            FileSystemAbstraction fs = mock(typeof(FileSystemAbstraction));

            when(fs.FileExists(_file)).thenReturn(false).thenReturn(true);
            when(fs.GetFileSize(_file)).thenReturn(42L);

            // When
            new IndexProviderStore(_file, fs, MetaDataStore.versionStringToLong("3.5"), false);

            // Then
            // exception is thrown
        }
 public override long GetFileSize(File fileName)
 {
     return(@delegate.GetFileSize(fileName));
 }