Exemplo n.º 1
0
        public void should_expand_correctly_for_explicit_id()
        {
            var explicitNewId = 30;
            var idPool        = new IdPool(10, 10);

            idPool.Expand(explicitNewId);

            Assert.Equal(idPool.AvailableIds.Count, explicitNewId);

            var expectedIdEntries = Enumerable.Range(1, explicitNewId - 1).ToArray();

            Assert.All(idPool.AvailableIds, x => expectedIdEntries.Contains(x));
        }
Exemplo n.º 2
0
        public void should_expand_correctly_with_auto_expansion()
        {
            var defaultExpansionAmount = 30;
            var originalSize           = 10;
            var expectedSize           = defaultExpansionAmount + originalSize;
            var idPool = new IdPool(defaultExpansionAmount, originalSize);

            idPool.Expand();

            Assert.Equal(idPool.AvailableIds.Count, expectedSize);

            var expectedIdEntries = Enumerable.Range(1, expectedSize - 1).ToArray();

            Assert.All(idPool.AvailableIds, x => expectedIdEntries.Contains(x));
        }