Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void slaveIdGeneratorShouldReturnFromAssignedRange()
        public virtual void SlaveIdGeneratorShouldReturnFromAssignedRange()
        {
            // GIVEN
            IdAllocation            firstResult = new IdAllocation(new IdRange(new long[] {}, 42, 123), 123, 0);
            Response <IdAllocation> response    = response(firstResult);

            when(_master.allocateIds(Null, any(typeof(IdType)))).thenReturn(response);

            // WHEN
            IdGenerator gen = SwitchToSlave();

            // THEN
            for (long i = firstResult.IdRange.RangeStart; i < firstResult.IdRange.RangeLength; i++)
            {
                assertEquals(i, gen.NextId());
            }
            verify(_master, times(1)).allocateIds(Null, eq(IdType.NODE));
        }