//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private <R extends org.neo4j.kernel.impl.store.record.AbstractBaseRecord> void readAndVerifyRecord(R written, R read, RecordFormat<R> format, RecordKey<R> key, org.neo4j.io.pagecache.PagedFile storeFile, int recordSize, boolean assertPostReadOffset) throws java.io.IOException
        private void ReadAndVerifyRecord <R>(R written, R read, RecordFormat <R> format, RecordKey <R> key, PagedFile storeFile, int recordSize, bool assertPostReadOffset) where R : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
        {
            using (PageCursor cursor = storeFile.Io(0, Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK))
            {
                AssertedNext(cursor);
                read.Id = written.Id;

                /*
                 * Retry loop is needed here because format does not handle retries on the primary cursor.
                 * Same retry is done on the store level in {@link org.neo4j.kernel.impl.store.CommonAbstractStore}
                 */
                int offset = Math.toIntExact(written.Id * recordSize);
                do
                {
                    cursor.Offset = offset;
                    format.Read(read, cursor, NORMAL, recordSize);
                } while (cursor.ShouldRetry());
                AssertWithinBounds(written, cursor, "reading");
                if (assertPostReadOffset)
                {
                    assertEquals("Cursor is positioned on first byte of next record after a read", offset + recordSize, cursor.Offset);
                }
                cursor.CheckAndClearCursorException();

                // THEN
                if (written.inUse())
                {
                    assertEquals(written.inUse(), read.inUse());
                    assertEquals(written.Id, read.Id);
                    assertEquals(written.SecondaryUnitId, read.SecondaryUnitId);
                    key.AssertRecordsEquals(written, read);
                }
                else
                {
                    assertEquals(written.inUse(), read.inUse());
                }
            }
        }