Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReuseIdBeforeHighId()
        public virtual void ShouldReuseIdBeforeHighId()
        {
            ReplicatedIdRangeAcquirer rangeAcquirer = SimpleRangeAcquirer(IdType.NODE, 0, 1024);

            long burnedIds = 23L;

            _idGenerator = GetReplicatedIdGenerator(10, burnedIds, rangeAcquirer);

            assertEquals(23, _idGenerator.nextId());

            _idGenerator.freeId(10);
            _idGenerator.freeId(5);

            assertEquals(10, _idGenerator.nextId());
            assertEquals(5, _idGenerator.nextId());
            assertEquals(24, _idGenerator.nextId());
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(expected = IllegalStateException.class) public void shouldThrowIfAdjustmentFailsDueToInconsistentValues()
        public virtual void ShouldThrowIfAdjustmentFailsDueToInconsistentValues()
        {
            ReplicatedIdRangeAcquirer rangeAcquirer = mock(typeof(ReplicatedIdRangeAcquirer));

            when(rangeAcquirer.AcquireIds(IdType.NODE)).thenReturn(Allocation(3, 21, 21));
            _idGenerator = GetReplicatedIdGenerator(10, 42L, rangeAcquirer);

            _idGenerator.nextId();
        }