/// <summary> /// Verifies the records on the current page of the cursor. /// <para> /// This does the do-while-retry loop internally. /// </para> /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void verifyRecordsMatchExpected(PageCursor cursor) throws java.io.IOException protected internal virtual void VerifyRecordsMatchExpected(PageCursor cursor) { ByteBuffer expectedPageContents = ByteBuffer.allocate(FilePageSize); ByteBuffer actualPageContents = ByteBuffer.allocate(FilePageSize); sbyte[] record = new sbyte[RecordSize]; long pageId = cursor.CurrentPageId; for (int i = 0; i < RecordsPerFilePage; i++) { long recordId = (pageId * RecordsPerFilePage) + i; expectedPageContents.position(RecordSize * i); ByteBuffer slice = expectedPageContents.slice(); slice.limit(RecordSize); GenerateRecordForId(recordId, slice); do { cursor.Offset = RecordSize * i; cursor.GetBytes(record); } while (cursor.ShouldRetry()); actualPageContents.position(RecordSize * i); actualPageContents.put(record); } AssertRecords(pageId, actualPageContents, expectedPageContents); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void readAndVerifyAdversarialPage(PageCursor cursor, int pageSize) throws java.io.IOException private void ReadAndVerifyAdversarialPage(PageCursor cursor, int pageSize) { sbyte[] actualPage = new sbyte[pageSize]; sbyte[] expectedPage = new sbyte[pageSize]; do { cursor.GetBytes(actualPage); } while (cursor.ShouldRetry()); Arrays.fill(expectedPage, actualPage[0]); string msg = string.Format("filePageId = {0}, pageSize = {1}", cursor.CurrentPageId, pageSize); assertThat(msg, actualPage, byteArray(expectedPage)); }