Example #1
0
        public void GetId_WithFirstBlock_IdIsOne()
        {
            var block = new IdBlock(1, 5);

            var id = block.GetId();

            Assert.AreEqual(1, id);
        }
Example #2
0
        public void GetId_ExpendAllIds_LastIdIsFive()
        {
            var block = new IdBlock(1, 5);
            ulong id = 0;
            while(block.HasIdsRemaining())
            {
                id = block.GetId();
            }

            Assert.AreEqual(5, id);
        }
Example #3
0
        public void GetId_LastIdOfBlockAndFirstOfNextBlock_AreSequential()
        {
            var blockA = new IdBlock(1, 5);
            var blockB = new IdBlock(2, 5);

            ulong lastId = 0;
            ulong nextId = 0;

            while(blockA.HasIdsRemaining())
            {
                lastId = blockA.GetId();
            }

            nextId = blockB.GetId();

            Assert.AreEqual(1, nextId - lastId);
        }