コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldHandleRelationshipTypesBeyond2Bytes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldHandleRelationshipTypesBeyond2Bytes()
        {
            // given
            RecordFormat <RelationshipTypeTokenRecord> format = HighLimit.RecordFormats.relationshipTypeToken();
            int typeId = 1 << ((sizeof(short) * 8) + (sizeof(sbyte) * 8)) - 1;
            RelationshipTypeTokenRecord record = new RelationshipTypeTokenRecord(typeId);
            int recordSize = format.GetRecordSize(NO_STORE_HEADER);

            record.Initialize(true, 10);
            IdSequence doubleUnits = mock(typeof(IdSequence));
            PageCursor cursor      = new StubPageCursor(0, ( int )kibiBytes(8));

            // when
            format.Prepare(record, recordSize, doubleUnits);
            format.Write(record, cursor, recordSize);
            verifyNoMoreInteractions(doubleUnits);

            // then
            RelationshipTypeTokenRecord read = new RelationshipTypeTokenRecord(typeId);

            format.Read(record, cursor, NORMAL, recordSize);
            assertEquals(record, read);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadAndWriteConsistentValues()
        public virtual void ShouldReadAndWriteConsistentValues()
        {
            Value[] values = new Value[] { DateTimeValue.datetime(9999, 100, ZoneId.of("+18:00")), DateTimeValue.datetime(10000, 100, ZoneId.of("-18:00")), DateTimeValue.datetime(10000, 100, ZoneOffset.of("-17:59:59")), DateTimeValue.datetime(10000, 100, ZoneId.of("UTC")), DateTimeValue.datetime(10000, 100, ZoneId.of("+01:00")), DateTimeValue.datetime(10000, 100, ZoneId.of("Europe/Stockholm")), DateTimeValue.datetime(10000, 100, ZoneId.of("+03:00")), DateTimeValue.datetime(10000, 101, ZoneId.of("-18:00")) };

            ZonedDateTimeLayout   layout   = new ZonedDateTimeLayout();
            PageCursor            cursor   = new StubPageCursor(0, 8 * 1024);
            ZonedDateTimeIndexKey writeKey = layout.NewKey();
            ZonedDateTimeIndexKey readKey  = layout.NewKey();

            // Write all
            foreach (Value value in values)
            {
                value.WriteTo(writeKey);
                layout.WriteKey(cursor, writeKey);
            }

            // Read all
            cursor.Offset = 0;
            foreach (Value value in values)
            {
                layout.ReadKey(cursor, readKey, ZonedDateTimeIndexKey.Size);
                assertEquals(value, readKey.AsValue());
            }
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUp()
        public virtual void SetUp()
        {
            _recordFormat = new PropertyRecordFormat();
            _pageCursor   = new StubPageCursor(0, ( int )ByteUnit.kibiBytes(8));
            _idSequence   = new ConstantIdSequence();
        }
コード例 #4
0
 private void ResetCursor(StubPageCursor cursor, int recordOffset)
 {
     cursor.Offset = recordOffset;
 }