Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldContinueThroughEmptyIdBatch()
        public virtual void ShouldContinueThroughEmptyIdBatch()
        {
            // given
            IdSequence            idSource = mock(typeof(IdSequence));
            IEnumerator <IdRange> ranges   = asList(new IdRange(EMPTY_LONG_ARRAY, 0, BATCH_SIZE), new IdRange(EMPTY_LONG_ARRAY, BATCH_SIZE, 0), new IdRange(EMPTY_LONG_ARRAY, BATCH_SIZE, BATCH_SIZE)).GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            when(idSource.NextIdBatch(anyInt())).thenAnswer(invocation => ranges.next());
            RenewableBatchIdSequence ids = new RenewableBatchIdSequence(idSource, BATCH_SIZE, _excessIds.add);

            // when/then
            for (long expectedId = 0; expectedId < BATCH_SIZE * 2; expectedId++)
            {
                assertEquals(expectedId, ids.NextId());
            }
        }
Пример #2
0
 private void InitializeInstanceFields()
 {
     _ids = new RenewableBatchIdSequence(_idSource, BATCH_SIZE, _excessIds.add);
 }